From 52cd683fb5abd91497b6bd388957c67b87fe6a02 Mon Sep 17 00:00:00 2001 From: max Date: Mon, 30 Nov 2009 18:21:23 +0000 Subject: [PATCH] Add IMBE vocoder git-svn-id: http://op25.osmocom.org/svn/trunk@187 65a5c917-d112-43f1-993d-58c26a4786be --- imbe_vocoder/AUTHORS | 1 + imbe_vocoder/COPYING | 674 +++++ imbe_vocoder/ChangeLog | 41 + imbe_vocoder/INSTALL | 229 ++ imbe_vocoder/Makefile.am | 29 + imbe_vocoder/Makefile.common | 38 + imbe_vocoder/NEWS | 0 imbe_vocoder/README | 17 + imbe_vocoder/bootstrap | 29 + imbe_vocoder/config/Makefile | 468 ++++ imbe_vocoder/config/Makefile.am | 66 + imbe_vocoder/config/Makefile.in | 468 ++++ imbe_vocoder/config/acx_pthread.m4 | 190 ++ imbe_vocoder/config/bnv_have_qt.m4 | 404 +++ imbe_vocoder/config/cppunit.m4 | 80 + imbe_vocoder/config/gr_as.m4 | 34 + imbe_vocoder/config/gr_boost.m4 | 111 + .../config/gr_check_createfilemapping.m4 | 52 + imbe_vocoder/config/gr_check_mc4020.m4 | 37 + imbe_vocoder/config/gr_check_shm_open.m4 | 29 + imbe_vocoder/config/gr_check_usrp.m4 | 32 + imbe_vocoder/config/gr_doxygen.m4 | 59 + imbe_vocoder/config/gr_gprof.m4 | 72 + .../gr_libgnuradio_core_extra_ldflags.m4 | 40 + imbe_vocoder/config/gr_no_undefined.m4 | 44 + imbe_vocoder/config/gr_omnithread.m4 | 51 + imbe_vocoder/config/gr_pwin32.m4 | 146 ++ imbe_vocoder/config/gr_python.m4 | 116 + imbe_vocoder/config/gr_require_mc4020.m4 | 33 + imbe_vocoder/config/gr_scripting.m4 | 30 + imbe_vocoder/config/gr_set_md_cpu.m4 | 44 + imbe_vocoder/config/gr_swig.m4 | 85 + imbe_vocoder/config/gr_sysv_shm.m4 | 36 + imbe_vocoder/config/gr_x86_64.m4 | 39 + imbe_vocoder/config/lf_cc.m4 | 42 + imbe_vocoder/config/lf_cxx.m4 | 121 + imbe_vocoder/config/lf_warnings.m4 | 128 + imbe_vocoder/config/lf_x11.m4 | 39 + imbe_vocoder/config/mkstemp.m4 | 89 + imbe_vocoder/config/onceonly.m4 | 63 + imbe_vocoder/config/pkg.m4 | 68 + imbe_vocoder/config/usrp_fusb_tech.m4 | 56 + imbe_vocoder/config/usrp_libusb.m4 | 43 + imbe_vocoder/config/usrp_sdcc.m4 | 67 + imbe_vocoder/configure.ac | 103 + imbe_vocoder/src/Makefile.am | 22 + imbe_vocoder/src/lib/Makefile.am | 113 + imbe_vocoder/src/lib/aux_sub.cc | 182 ++ imbe_vocoder/src/lib/aux_sub.h | 133 + imbe_vocoder/src/lib/basic_op.h | 85 + imbe_vocoder/src/lib/basicop2.cc | 2157 +++++++++++++++++ imbe_vocoder/src/lib/ch_decode.cc | 182 ++ imbe_vocoder/src/lib/ch_decode.h | 32 + imbe_vocoder/src/lib/ch_encode.cc | 110 + imbe_vocoder/src/lib/ch_encode.h | 32 + imbe_vocoder/src/lib/dc_rmv.cc | 66 + imbe_vocoder/src/lib/dc_rmv.h | 46 + imbe_vocoder/src/lib/decode.cc | 60 + imbe_vocoder/src/lib/decode.h | 30 + imbe_vocoder/src/lib/dsp_sub.cc | 278 +++ imbe_vocoder/src/lib/dsp_sub.h | 81 + imbe_vocoder/src/lib/encode.cc | 97 + imbe_vocoder/src/lib/encode.h | 32 + imbe_vocoder/src/lib/globals.h | 62 + imbe_vocoder/src/lib/imbe.h | 69 + imbe_vocoder/src/lib/math_sub.cc | 355 +++ imbe_vocoder/src/lib/math_sub.h | 130 + imbe_vocoder/src/lib/op25_imbe.i | 41 + imbe_vocoder/src/lib/op25_imbe_vocoder.cc | 376 +++ imbe_vocoder/src/lib/op25_imbe_vocoder.h | 175 ++ imbe_vocoder/src/lib/pe_lpf.cc | 74 + imbe_vocoder/src/lib/pe_lpf.h | 47 + imbe_vocoder/src/lib/pitch_est.cc | 353 +++ imbe_vocoder/src/lib/pitch_est.h | 29 + imbe_vocoder/src/lib/pitch_ref.cc | 167 ++ imbe_vocoder/src/lib/pitch_ref.h | 28 + imbe_vocoder/src/lib/qnt_sub.cc | 144 ++ imbe_vocoder/src/lib/qnt_sub.h | 86 + imbe_vocoder/src/lib/rand_gen.cc | 61 + imbe_vocoder/src/lib/rand_gen.h | 44 + imbe_vocoder/src/lib/sa_decode.cc | 200 ++ imbe_vocoder/src/lib/sa_decode.h | 64 + imbe_vocoder/src/lib/sa_encode.cc | 296 +++ imbe_vocoder/src/lib/sa_encode.h | 30 + imbe_vocoder/src/lib/sa_enh.cc | 200 ++ imbe_vocoder/src/lib/sa_enh.h | 50 + imbe_vocoder/src/lib/tbls.cc | 368 +++ imbe_vocoder/src/lib/tbls.h | 99 + imbe_vocoder/src/lib/typedef.h | 74 + imbe_vocoder/src/lib/typedefs.h | 201 ++ imbe_vocoder/src/lib/uv_synt.cc | 147 ++ imbe_vocoder/src/lib/uv_synt.h | 29 + imbe_vocoder/src/lib/v_synt.cc | 248 ++ imbe_vocoder/src/lib/v_synt.h | 30 + imbe_vocoder/src/lib/v_uv_det.cc | 373 +++ imbe_vocoder/src/lib/v_uv_det.h | 28 + imbe_vocoder/src/python/Makefile | 510 ++++ imbe_vocoder/src/python/Makefile.am | 32 + imbe_vocoder/src/python/Makefile.in | 510 ++++ imbe_vocoder/src/python/qa_op25_imbe.py | 3 + imbe_vocoder/src/python/run_tests | 50 + imbe_vocoder/src/python/run_tests.in | 50 + 102 files changed, 14214 insertions(+) create mode 100644 imbe_vocoder/AUTHORS create mode 100644 imbe_vocoder/COPYING create mode 100644 imbe_vocoder/ChangeLog create mode 100644 imbe_vocoder/INSTALL create mode 100644 imbe_vocoder/Makefile.am create mode 100644 imbe_vocoder/Makefile.common create mode 100644 imbe_vocoder/NEWS create mode 100644 imbe_vocoder/README create mode 100755 imbe_vocoder/bootstrap create mode 100644 imbe_vocoder/config/Makefile create mode 100644 imbe_vocoder/config/Makefile.am create mode 100644 imbe_vocoder/config/Makefile.in create mode 100644 imbe_vocoder/config/acx_pthread.m4 create mode 100644 imbe_vocoder/config/bnv_have_qt.m4 create mode 100644 imbe_vocoder/config/cppunit.m4 create mode 100644 imbe_vocoder/config/gr_as.m4 create mode 100644 imbe_vocoder/config/gr_boost.m4 create mode 100644 imbe_vocoder/config/gr_check_createfilemapping.m4 create mode 100644 imbe_vocoder/config/gr_check_mc4020.m4 create mode 100644 imbe_vocoder/config/gr_check_shm_open.m4 create mode 100644 imbe_vocoder/config/gr_check_usrp.m4 create mode 100644 imbe_vocoder/config/gr_doxygen.m4 create mode 100644 imbe_vocoder/config/gr_gprof.m4 create mode 100644 imbe_vocoder/config/gr_libgnuradio_core_extra_ldflags.m4 create mode 100644 imbe_vocoder/config/gr_no_undefined.m4 create mode 100644 imbe_vocoder/config/gr_omnithread.m4 create mode 100644 imbe_vocoder/config/gr_pwin32.m4 create mode 100644 imbe_vocoder/config/gr_python.m4 create mode 100644 imbe_vocoder/config/gr_require_mc4020.m4 create mode 100644 imbe_vocoder/config/gr_scripting.m4 create mode 100644 imbe_vocoder/config/gr_set_md_cpu.m4 create mode 100644 imbe_vocoder/config/gr_swig.m4 create mode 100644 imbe_vocoder/config/gr_sysv_shm.m4 create mode 100644 imbe_vocoder/config/gr_x86_64.m4 create mode 100644 imbe_vocoder/config/lf_cc.m4 create mode 100644 imbe_vocoder/config/lf_cxx.m4 create mode 100644 imbe_vocoder/config/lf_warnings.m4 create mode 100644 imbe_vocoder/config/lf_x11.m4 create mode 100644 imbe_vocoder/config/mkstemp.m4 create mode 100644 imbe_vocoder/config/onceonly.m4 create mode 100644 imbe_vocoder/config/pkg.m4 create mode 100644 imbe_vocoder/config/usrp_fusb_tech.m4 create mode 100644 imbe_vocoder/config/usrp_libusb.m4 create mode 100644 imbe_vocoder/config/usrp_sdcc.m4 create mode 100644 imbe_vocoder/configure.ac create mode 100644 imbe_vocoder/src/Makefile.am create mode 100644 imbe_vocoder/src/lib/Makefile.am create mode 100644 imbe_vocoder/src/lib/aux_sub.cc create mode 100644 imbe_vocoder/src/lib/aux_sub.h create mode 100644 imbe_vocoder/src/lib/basic_op.h create mode 100644 imbe_vocoder/src/lib/basicop2.cc create mode 100644 imbe_vocoder/src/lib/ch_decode.cc create mode 100644 imbe_vocoder/src/lib/ch_decode.h create mode 100644 imbe_vocoder/src/lib/ch_encode.cc create mode 100644 imbe_vocoder/src/lib/ch_encode.h create mode 100644 imbe_vocoder/src/lib/dc_rmv.cc create mode 100644 imbe_vocoder/src/lib/dc_rmv.h create mode 100644 imbe_vocoder/src/lib/decode.cc create mode 100644 imbe_vocoder/src/lib/decode.h create mode 100644 imbe_vocoder/src/lib/dsp_sub.cc create mode 100644 imbe_vocoder/src/lib/dsp_sub.h create mode 100644 imbe_vocoder/src/lib/encode.cc create mode 100644 imbe_vocoder/src/lib/encode.h create mode 100644 imbe_vocoder/src/lib/globals.h create mode 100644 imbe_vocoder/src/lib/imbe.h create mode 100644 imbe_vocoder/src/lib/math_sub.cc create mode 100644 imbe_vocoder/src/lib/math_sub.h create mode 100644 imbe_vocoder/src/lib/op25_imbe.i create mode 100644 imbe_vocoder/src/lib/op25_imbe_vocoder.cc create mode 100644 imbe_vocoder/src/lib/op25_imbe_vocoder.h create mode 100644 imbe_vocoder/src/lib/pe_lpf.cc create mode 100644 imbe_vocoder/src/lib/pe_lpf.h create mode 100644 imbe_vocoder/src/lib/pitch_est.cc create mode 100644 imbe_vocoder/src/lib/pitch_est.h create mode 100644 imbe_vocoder/src/lib/pitch_ref.cc create mode 100644 imbe_vocoder/src/lib/pitch_ref.h create mode 100644 imbe_vocoder/src/lib/qnt_sub.cc create mode 100644 imbe_vocoder/src/lib/qnt_sub.h create mode 100644 imbe_vocoder/src/lib/rand_gen.cc create mode 100644 imbe_vocoder/src/lib/rand_gen.h create mode 100644 imbe_vocoder/src/lib/sa_decode.cc create mode 100644 imbe_vocoder/src/lib/sa_decode.h create mode 100644 imbe_vocoder/src/lib/sa_encode.cc create mode 100644 imbe_vocoder/src/lib/sa_encode.h create mode 100644 imbe_vocoder/src/lib/sa_enh.cc create mode 100644 imbe_vocoder/src/lib/sa_enh.h create mode 100644 imbe_vocoder/src/lib/tbls.cc create mode 100644 imbe_vocoder/src/lib/tbls.h create mode 100644 imbe_vocoder/src/lib/typedef.h create mode 100644 imbe_vocoder/src/lib/typedefs.h create mode 100644 imbe_vocoder/src/lib/uv_synt.cc create mode 100644 imbe_vocoder/src/lib/uv_synt.h create mode 100644 imbe_vocoder/src/lib/v_synt.cc create mode 100644 imbe_vocoder/src/lib/v_synt.h create mode 100644 imbe_vocoder/src/lib/v_uv_det.cc create mode 100644 imbe_vocoder/src/lib/v_uv_det.h create mode 100644 imbe_vocoder/src/python/Makefile create mode 100644 imbe_vocoder/src/python/Makefile.am create mode 100644 imbe_vocoder/src/python/Makefile.in create mode 100755 imbe_vocoder/src/python/qa_op25_imbe.py create mode 100755 imbe_vocoder/src/python/run_tests create mode 100644 imbe_vocoder/src/python/run_tests.in diff --git a/imbe_vocoder/AUTHORS b/imbe_vocoder/AUTHORS new file mode 100644 index 0000000..ee4560a --- /dev/null +++ b/imbe_vocoder/AUTHORS @@ -0,0 +1 @@ +Eric Blossom diff --git a/imbe_vocoder/COPYING b/imbe_vocoder/COPYING new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/imbe_vocoder/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + 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 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 . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/imbe_vocoder/ChangeLog b/imbe_vocoder/ChangeLog new file mode 100644 index 0000000..ad9c5a8 --- /dev/null +++ b/imbe_vocoder/ChangeLog @@ -0,0 +1,41 @@ +2005-07-02 Eric Blossom + + * config/gr_no_undefined.m4, config/gr_x86_64.m4: new, x86_64 support. + * config/gr_python.m4: backed out search for libpython, making + x86_64 work and breaking Cygwin/MinGW. + * configure.ac, src/lib/Makefile.am: mods for x86_64, $(NO_UNDEFINED) + +2005-05-09 Stephane Fillod + + * config/gr_sysv_shm.m4: SysV shared memory not mandatory + * config/gr_pwin32.m4, config/gr_python.m4, config/lf_cxx.m4: + fixes for Cygwin, MinGW + +2005-01-29 Eric Blossom + + * src/lib/Makefile.am: mods for SWIG 1.3.24 + +2005-01-20 Eric Blossom + + * doc/howto-write-a-block.xml: made release 0.1 + +# +# Copyright 2005 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# diff --git a/imbe_vocoder/INSTALL b/imbe_vocoder/INSTALL new file mode 100644 index 0000000..54caf7c --- /dev/null +++ b/imbe_vocoder/INSTALL @@ -0,0 +1,229 @@ +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software +Foundation, Inc. + + This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +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, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. (Caching is +disabled by default to prevent problems with accidental use of stale +cache files.) + + 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 you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') 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. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + + *Note Defining Variables::, for more details. + +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 support 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' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + 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 machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the `--target=TYPE' option to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +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. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +will cause the specified gcc to be used as the C compiler (unless it is +overridden in the site shell script). + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--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. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/imbe_vocoder/Makefile.am b/imbe_vocoder/Makefile.am new file mode 100644 index 0000000..9f4c498 --- /dev/null +++ b/imbe_vocoder/Makefile.am @@ -0,0 +1,29 @@ +# +# Copyright 2004 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# + +include $(top_srcdir)/Makefile.common + +EXTRA_DIST = bootstrap configure config.h.in .buildpri +SUBDIRS = config src +DIST_SUBDIRS = config src + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = diff --git a/imbe_vocoder/Makefile.common b/imbe_vocoder/Makefile.common new file mode 100644 index 0000000..261de50 --- /dev/null +++ b/imbe_vocoder/Makefile.common @@ -0,0 +1,38 @@ +# -*- Makefile -*- +# +# Copyright 2004,2006 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# + +# includes +grincludedir = $(includedir)/gnuradio + +# swig includes +swigincludedir = $(grincludedir)/swig + +# Install this stuff in the appropriate subdirectory +# This usually ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio + +grpythondir = $(pythondir)/gnuradio +grpyexecdir = $(pyexecdir)/gnuradio + +# swig flags +SWIGPYTHONFLAGS = -fvirtual -python -modern +SWIGGRFLAGS = -I$(GNURADIO_CORE_INCLUDEDIR)/swig -I$(GNURADIO_CORE_INCLUDEDIR) diff --git a/imbe_vocoder/NEWS b/imbe_vocoder/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/imbe_vocoder/README b/imbe_vocoder/README new file mode 100644 index 0000000..08d4415 --- /dev/null +++ b/imbe_vocoder/README @@ -0,0 +1,17 @@ + +# This directory contains Pavel Yazev's Project 25 IMBE Encoder/Decoder +# It also contains KA1RBI's interface module for GNU Radio + +If you're building from SVN, you'll need to use this sequence, since +SVN doesn't contain configure or the generated Makefiles. + + $ ./bootstrap + $ ./configure + $ make + $ make check + +For increased performance, you may wish to consider compiling with higher +optimization, for example: + $ ./configure CXXFLAGS="-O3" +or + $ ./configure CXXFLAGS="-O6" diff --git a/imbe_vocoder/bootstrap b/imbe_vocoder/bootstrap new file mode 100755 index 0000000..7df375e --- /dev/null +++ b/imbe_vocoder/bootstrap @@ -0,0 +1,29 @@ +#!/bin/sh + +# Copyright 2001,2005 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + + +rm -fr config.cache autom4te*.cache + +aclocal -I config +autoconf +autoheader +libtoolize --automake +automake --add-missing diff --git a/imbe_vocoder/config/Makefile b/imbe_vocoder/config/Makefile new file mode 100644 index 0000000..be2e614 --- /dev/null +++ b/imbe_vocoder/config/Makefile @@ -0,0 +1,468 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# config/Makefile. Generated from Makefile.in by configure. + +# 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. + + + +# +# Copyright 2001 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# + +# -*- Makefile -*- +# +# Copyright 2004,2006 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# +srcdir = . +top_srcdir = .. + +pkgdatadir = $(datadir)/gr-op25_imbe +pkglibdir = $(libdir)/gr-op25_imbe +pkgincludedir = $(includedir)/gr-op25_imbe +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = /usr/bin/install -c +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 = i686-pc-linux-gnu +host_triplet = i686-pc-linux-gnu +target_triplet = i686-pc-linux-gnu +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/Makefile.common +subdir = config +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/config/acx_pthread.m4 \ + $(top_srcdir)/config/gr_as.m4 $(top_srcdir)/config/gr_boost.m4 \ + $(top_srcdir)/config/gr_gprof.m4 \ + $(top_srcdir)/config/gr_no_undefined.m4 \ + $(top_srcdir)/config/gr_omnithread.m4 \ + $(top_srcdir)/config/gr_pwin32.m4 \ + $(top_srcdir)/config/gr_python.m4 \ + $(top_srcdir)/config/gr_scripting.m4 \ + $(top_srcdir)/config/gr_swig.m4 \ + $(top_srcdir)/config/gr_x86_64.m4 \ + $(top_srcdir)/config/lf_cxx.m4 \ + $(top_srcdir)/config/lf_warnings.m4 \ + $(top_srcdir)/config/pkg.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} /home/mhp/imbe_vocoder/missing --run aclocal-1.9 +AMDEP_FALSE = # +AMDEP_TRUE = +AMTAR = ${SHELL} /home/mhp/imbe_vocoder/missing --run tar +AR = ar +AS = as +AUTOCONF = ${SHELL} /home/mhp/imbe_vocoder/missing --run autoconf +AUTOHEADER = ${SHELL} /home/mhp/imbe_vocoder/missing --run autoheader +AUTOMAKE = ${SHELL} /home/mhp/imbe_vocoder/missing --run automake-1.9 +AWK = gawk +BOOST_CFLAGS = -I/usr/local/include/boost-1_37 +CC = gcc +CCAS = $(CC) +CCASFLAGS = $(CFLAGS) +CCDEPMODE = depmode=gcc3 +CFLAGS = -g -O2 -pthread +CPP = gcc -E +CPPFLAGS = +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O6 -Wall -Woverloaded-virtual -pthread +CXX_FOR_BUILD = g++ +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DLLTOOL = dlltool +ECHO = echo +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = grep -E +EXEEXT = +F77 = +FFLAGS = +GNURADIO_CORE_CFLAGS = -pthread -DOMNITHREAD_POSIX=1 -I/usr/local/include/boost-1_37 -I/usr/local/include/gnuradio -I/usr/local/include +GNURADIO_CORE_INCLUDEDIR = /usr/local/include/gnuradio +GNURADIO_CORE_LIBS = -L/usr/local/lib -lgnuradio-core -lboost_thread-gcc41-mt-1_37 -lrt -lboost_date_time-gcc41-mt-1_37 -lgruel -lfftw3f -lgsl -lgslcblas -lm -lgromnithread +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s +LDFLAGS = +LIBOBJS = +LIBS = -L/usr/local/lib -lgnuradio-core -lboost_thread-gcc41-mt-1_37 -lrt -lboost_date_time-gcc41-mt-1_37 -lgruel -lfftw3f -lgsl -lgslcblas -lm -lgromnithread +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LN_S = ln -s +LTLIBOBJS = +MAKEINFO = ${SHELL} /home/mhp/imbe_vocoder/missing --run makeinfo +NO_UNDEFINED = +OBJDUMP = objdump +OBJEXT = o +OMNITHREAD_NT_FALSE = +OMNITHREAD_NT_TRUE = # +OMNITHREAD_POSIX_FALSE = # +OMNITHREAD_POSIX_TRUE = +PACKAGE = gr-op25_imbe +PACKAGE_BUGREPORT = +PACKAGE_NAME = +PACKAGE_STRING = +PACKAGE_TARNAME = +PACKAGE_VERSION = +PATH_SEPARATOR = : +PKG_CONFIG = /usr/bin/pkg-config +PTHREAD_CC = gcc +PTHREAD_CFLAGS = -pthread +PTHREAD_LIBS = -lrt +PYTHON = /usr/bin/python +PYTHON_CPPFLAGS = -I/usr/include/python2.4 +PYTHON_EXEC_PREFIX = ${exec_prefix} +PYTHON_LDFLAGS = +PYTHON_PLATFORM = linux2 +PYTHON_PREFIX = ${prefix} +PYTHON_VERSION = 2.4 +RANLIB = ranlib +SED = /bin/sed +SET_MAKE = +SHELL = /bin/sh +STD_DEFINES_AND_INCLUDES = -pthread -DOMNITHREAD_POSIX=1 -I/usr/local/include/boost-1_37 -I/usr/local/include/gnuradio -I/usr/local/include -I/usr/local/include/boost-1_37 +STRIP = strip +SWIG = /usr/local/bin/swig -c++ +SWIG_PYTHON_CPPFLAGS = -I/usr/include/python2.4 +SWIG_PYTHON_LIB = -lswigpy +SWIG_PYTHON_OPT = -python +VERSION = 0.1 +ac_ct_AR = ar +ac_ct_AS = +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_DLLTOOL = +ac_ct_F77 = +ac_ct_OBJDUMP = +ac_ct_RANLIB = ranlib +ac_ct_STRIP = strip +am__fastdepCC_FALSE = # +am__fastdepCC_TRUE = +am__fastdepCXX_FALSE = # +am__fastdepCXX_TRUE = +am__include = include +am__leading_dot = . +am__quote = +am__tar = ${AMTAR} chof - "$$tardir" +am__untar = ${AMTAR} xf - +bindir = ${exec_prefix}/bin +build = i686-pc-linux-gnu +build_alias = +build_cpu = i686 +build_os = linux-gnu +build_vendor = pc +datadir = ${prefix}/share +exec_prefix = ${prefix} +host = i686-pc-linux-gnu +host_alias = +host_cpu = i686 +host_os = linux-gnu +host_vendor = pc +includedir = ${prefix}/include +infodir = ${prefix}/info +install_sh = /home/mhp/imbe_vocoder/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localstatedir = ${prefix}/var +mandir = ${prefix}/man +mkdir_p = mkdir -p -- +oldincludedir = /usr/include +pkgpyexecdir = ${pyexecdir}/gr-op25_imbe +pkgpythondir = ${pythondir}/gr-op25_imbe +prefix = /usr +program_transform_name = s,x,x, +pyexecdir = ${exec_prefix}/lib/python2.4/site-packages +pythondir = ${prefix}/lib/python2.4/site-packages +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +sysconfdir = ${prefix}/etc +target = i686-pc-linux-gnu +target_alias = +target_cpu = i686 +target_os = linux-gnu +target_vendor = pc + +# includes +grincludedir = $(includedir)/gnuradio + +# swig includes +swigincludedir = $(grincludedir)/swig + +# Install this stuff in the appropriate subdirectory +# This usually ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio +grpythondir = $(pythondir)/gnuradio +grpyexecdir = $(pyexecdir)/gnuradio + +# swig flags +SWIGPYTHONFLAGS = -fvirtual -python -modern +SWIGGRFLAGS = -I$(GNURADIO_CORE_INCLUDEDIR)/swig -I$(GNURADIO_CORE_INCLUDEDIR) + +# Install m4 macros in this directory +m4datadir = $(datadir)/aclocal + +# List your m4 macros here +m4macros = \ + acx_pthread.m4 \ + bnv_have_qt.m4 \ + cppunit.m4 \ + gr_as.m4 \ + gr_boost.m4 \ + gr_check_createfilemapping.m4 \ + gr_check_usrp.m4 \ + gr_check_mc4020.m4 \ + gr_check_shm_open.m4 \ + gr_doxygen.m4 \ + gr_gprof.m4 \ + gr_libgnuradio_core_extra_ldflags.m4 \ + gr_no_undefined.m4 \ + gr_omnithread.m4 \ + gr_pwin32.m4 \ + gr_python.m4 \ + gr_require_mc4020.m4 \ + gr_scripting.m4 \ + gr_set_md_cpu.m4 \ + gr_swig.m4 \ + gr_sysv_shm.m4 \ + gr_x86_64.m4 \ + lf_cc.m4 \ + lf_cxx.m4 \ + lf_warnings.m4 \ + lf_x11.m4 \ + mkstemp.m4 \ + onceonly.m4 \ + pkg.m4 \ + usrp_fusb_tech.m4 \ + usrp_libusb.m4 \ + usrp_sdcc.m4 + + +# Don't install m4 macros anymore +# m4data_DATA = $(m4macros) +EXTRA_DIST = $(m4macros) +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(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 config/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu config/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: +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + $(mkdir_p) $(distdir)/.. + @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." +clean: clean-am + +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 + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/imbe_vocoder/config/Makefile.am b/imbe_vocoder/config/Makefile.am new file mode 100644 index 0000000..2154a22 --- /dev/null +++ b/imbe_vocoder/config/Makefile.am @@ -0,0 +1,66 @@ +# +# Copyright 2001 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# + +include $(top_srcdir)/Makefile.common + +# Install m4 macros in this directory +m4datadir = $(datadir)/aclocal + +# List your m4 macros here +m4macros = \ + acx_pthread.m4 \ + bnv_have_qt.m4 \ + cppunit.m4 \ + gr_as.m4 \ + gr_boost.m4 \ + gr_check_createfilemapping.m4 \ + gr_check_usrp.m4 \ + gr_check_mc4020.m4 \ + gr_check_shm_open.m4 \ + gr_doxygen.m4 \ + gr_gprof.m4 \ + gr_libgnuradio_core_extra_ldflags.m4 \ + gr_no_undefined.m4 \ + gr_omnithread.m4 \ + gr_pwin32.m4 \ + gr_python.m4 \ + gr_require_mc4020.m4 \ + gr_scripting.m4 \ + gr_set_md_cpu.m4 \ + gr_swig.m4 \ + gr_sysv_shm.m4 \ + gr_x86_64.m4 \ + lf_cc.m4 \ + lf_cxx.m4 \ + lf_warnings.m4 \ + lf_x11.m4 \ + mkstemp.m4 \ + onceonly.m4 \ + pkg.m4 \ + usrp_fusb_tech.m4 \ + usrp_libusb.m4 \ + usrp_sdcc.m4 + + +# Don't install m4 macros anymore +# m4data_DATA = $(m4macros) + +EXTRA_DIST = $(m4macros) diff --git a/imbe_vocoder/config/Makefile.in b/imbe_vocoder/config/Makefile.in new file mode 100644 index 0000000..6927960 --- /dev/null +++ b/imbe_vocoder/config/Makefile.in @@ -0,0 +1,468 @@ +# 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@ + +# +# Copyright 2001 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# + +# -*- Makefile -*- +# +# Copyright 2004,2006 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# +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@ +target_triplet = @target@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/Makefile.common +subdir = config +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/config/acx_pthread.m4 \ + $(top_srcdir)/config/gr_as.m4 $(top_srcdir)/config/gr_boost.m4 \ + $(top_srcdir)/config/gr_gprof.m4 \ + $(top_srcdir)/config/gr_no_undefined.m4 \ + $(top_srcdir)/config/gr_omnithread.m4 \ + $(top_srcdir)/config/gr_pwin32.m4 \ + $(top_srcdir)/config/gr_python.m4 \ + $(top_srcdir)/config/gr_scripting.m4 \ + $(top_srcdir)/config/gr_swig.m4 \ + $(top_srcdir)/config/gr_x86_64.m4 \ + $(top_srcdir)/config/lf_cxx.m4 \ + $(top_srcdir)/config/lf_warnings.m4 \ + $(top_srcdir)/config/pkg.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +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@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BOOST_CFLAGS = @BOOST_CFLAGS@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CXX_FOR_BUILD = @CXX_FOR_BUILD@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GNURADIO_CORE_CFLAGS = @GNURADIO_CORE_CFLAGS@ +GNURADIO_CORE_INCLUDEDIR = @GNURADIO_CORE_INCLUDEDIR@ +GNURADIO_CORE_LIBS = @GNURADIO_CORE_LIBS@ +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@ +NO_UNDEFINED = @NO_UNDEFINED@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OMNITHREAD_NT_FALSE = @OMNITHREAD_NT_FALSE@ +OMNITHREAD_NT_TRUE = @OMNITHREAD_NT_TRUE@ +OMNITHREAD_POSIX_FALSE = @OMNITHREAD_POSIX_FALSE@ +OMNITHREAD_POSIX_TRUE = @OMNITHREAD_POSIX_TRUE@ +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@ +PKG_CONFIG = @PKG_CONFIG@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STD_DEFINES_AND_INCLUDES = @STD_DEFINES_AND_INCLUDES@ +STRIP = @STRIP@ +SWIG = @SWIG@ +SWIG_PYTHON_CPPFLAGS = @SWIG_PYTHON_CPPFLAGS@ +SWIG_PYTHON_LIB = @SWIG_PYTHON_LIB@ +SWIG_PYTHON_OPT = @SWIG_PYTHON_OPT@ +VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_AS = @ac_ct_AS@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_OBJDUMP = @ac_ct_OBJDUMP@ +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@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ + +# includes +grincludedir = $(includedir)/gnuradio + +# swig includes +swigincludedir = $(grincludedir)/swig + +# Install this stuff in the appropriate subdirectory +# This usually ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio +grpythondir = $(pythondir)/gnuradio +grpyexecdir = $(pyexecdir)/gnuradio + +# swig flags +SWIGPYTHONFLAGS = -fvirtual -python -modern +SWIGGRFLAGS = -I$(GNURADIO_CORE_INCLUDEDIR)/swig -I$(GNURADIO_CORE_INCLUDEDIR) + +# Install m4 macros in this directory +m4datadir = $(datadir)/aclocal + +# List your m4 macros here +m4macros = \ + acx_pthread.m4 \ + bnv_have_qt.m4 \ + cppunit.m4 \ + gr_as.m4 \ + gr_boost.m4 \ + gr_check_createfilemapping.m4 \ + gr_check_usrp.m4 \ + gr_check_mc4020.m4 \ + gr_check_shm_open.m4 \ + gr_doxygen.m4 \ + gr_gprof.m4 \ + gr_libgnuradio_core_extra_ldflags.m4 \ + gr_no_undefined.m4 \ + gr_omnithread.m4 \ + gr_pwin32.m4 \ + gr_python.m4 \ + gr_require_mc4020.m4 \ + gr_scripting.m4 \ + gr_set_md_cpu.m4 \ + gr_swig.m4 \ + gr_sysv_shm.m4 \ + gr_x86_64.m4 \ + lf_cc.m4 \ + lf_cxx.m4 \ + lf_warnings.m4 \ + lf_x11.m4 \ + mkstemp.m4 \ + onceonly.m4 \ + pkg.m4 \ + usrp_fusb_tech.m4 \ + usrp_libusb.m4 \ + usrp_sdcc.m4 + + +# Don't install m4 macros anymore +# m4data_DATA = $(m4macros) +EXTRA_DIST = $(m4macros) +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(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 config/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu config/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: +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + $(mkdir_p) $(distdir)/.. + @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." +clean: clean-am + +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 + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/imbe_vocoder/config/acx_pthread.m4 b/imbe_vocoder/config/acx_pthread.m4 new file mode 100644 index 0000000..d318ab0 --- /dev/null +++ b/imbe_vocoder/config/acx_pthread.m4 @@ -0,0 +1,190 @@ +dnl Available from the GNU Autoconf Macro Archive at: +dnl http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.html +dnl +AC_DEFUN([ACX_PTHREAD], [ +AC_REQUIRE([AC_CANONICAL_HOST]) +AC_LANG_SAVE +AC_LANG_C +acx_pthread_ok=no + +# We used to check for pthread.h first, but this fails if pthread.h +# requires special compiler flags (e.g. on True64 or Sequent). +# It gets checked for in the link test anyway. + +# First of all, check if the user has set any of the PTHREAD_LIBS, +# etcetera environment variables, and if threads linking works using +# them: +if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) + AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes) + AC_MSG_RESULT($acx_pthread_ok) + if test x"$acx_pthread_ok" = xno; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" +fi + +# We must check for the threads library under a number of different +# names; the ordering is very important because some systems +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +# libraries is broken (non-POSIX). + +# Create a list of thread flags to try. Items starting with a "-" are +# C compiler flags, and other items are library names, except for "none" +# which indicates that we try without any flags at all. + +acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt" + +# The ordering *is* (sometimes) important. Some notes on the +# individual items follow: + +# pthreads: AIX (must check this before -lpthread) +# none: in case threads are in libc; should be tried before -Kthread and +# other compiler flags to prevent continual compiler warnings +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) +# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) +# -pthreads: Solaris/gcc +# -mthreads: Mingw32/gcc, Lynx/gcc +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +# doesn't hurt to check since this sometimes defines pthreads too; +# also defines -D_REENTRANT) +# pthread: Linux, etcetera +# --thread-safe: KAI C++ + +case "${host_cpu}-${host_os}" in + *solaris*) + + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (We need to link with -pthread or + # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather + # a function called by this macro, so we could check for that, but + # who knows whether they'll stub that too in a future libc.) So, + # we'll just look for -pthreads and -lpthread first: + + acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags" + ;; +esac + +if test x"$acx_pthread_ok" = xno; then +for flag in $acx_pthread_flags; do + + case $flag in + none) + AC_MSG_CHECKING([whether pthreads work without any flags]) + ;; + + -*) + AC_MSG_CHECKING([whether pthreads work with $flag]) + PTHREAD_CFLAGS="$flag" + ;; + + *) + AC_MSG_CHECKING([for the pthreads library -l$flag]) + PTHREAD_LIBS="-l$flag" + ;; + esac + + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + AC_TRY_LINK([#include ], + [pthread_t th; pthread_join(th, 0); + pthread_attr_init(0); pthread_cleanup_push(0, 0); + pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], + [acx_pthread_ok=yes]) + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + AC_MSG_RESULT($acx_pthread_ok) + if test "x$acx_pthread_ok" = xyes; then + break; + fi + + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +done +fi + +# Various other checks: +if test "x$acx_pthread_ok" = xyes; then + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Detect AIX lossage: threads are created detached by default + # and the JOINABLE attribute has a nonstandard name (UNDETACHED). + AC_MSG_CHECKING([for joinable pthread attribute]) + AC_TRY_LINK([#include ], + [int attr=PTHREAD_CREATE_JOINABLE;], + ok=PTHREAD_CREATE_JOINABLE, ok=unknown) + if test x"$ok" = xunknown; then + AC_TRY_LINK([#include ], + [int attr=PTHREAD_CREATE_UNDETACHED;], + ok=PTHREAD_CREATE_UNDETACHED, ok=unknown) + fi + if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then + AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok, + [Define to the necessary symbol if this constant + uses a non-standard name on your system.]) + fi + AC_MSG_RESULT(${ok}) + if test x"$ok" = xunknown; then + AC_MSG_WARN([we do not know how to create joinable pthreads]) + fi + + AC_MSG_CHECKING([if more special flags are required for pthreads]) + flag=no + case "${host_cpu}-${host_os}" in + *-aix* | *-freebsd*) flag="-D_THREAD_SAFE";; + *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; + esac + AC_MSG_RESULT(${flag}) + if test "x$flag" != xno; then + PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" + fi + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + # More AIX lossage: must compile with cc_r + AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC}) +else + PTHREAD_CC="$CC" +fi + +AC_SUBST(PTHREAD_LIBS) +AC_SUBST(PTHREAD_CFLAGS) +AC_SUBST(PTHREAD_CC) + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test x"$acx_pthread_ok" = xyes; then + ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) + : +else + acx_pthread_ok=no + $2 +fi +AC_LANG_RESTORE +])dnl ACX_PTHREAD diff --git a/imbe_vocoder/config/bnv_have_qt.m4 b/imbe_vocoder/config/bnv_have_qt.m4 new file mode 100644 index 0000000..1469bfb --- /dev/null +++ b/imbe_vocoder/config/bnv_have_qt.m4 @@ -0,0 +1,404 @@ +dnl Available from the GNU Autoconf Macro Archive at: +dnl http://www.gnu.org/software/ac-archive/htmldoc/bnv_have_qt.html +dnl +AC_DEFUN([BNV_HAVE_QT], +[ + dnl THANKS! This code includes bug fixes by: + dnl Tim McClarren. + + AC_REQUIRE([AC_PROG_CXX]) + AC_REQUIRE([AC_PATH_X]) + AC_REQUIRE([AC_PATH_XTRA]) + + AC_MSG_CHECKING(for Qt) + + AC_ARG_WITH([Qt-dir], + [ --with-Qt-dir=DIR DIR is equal to \$QTDIR if you have followed the + installation instructions of Trolltech. Header + files are in DIR/include, binary utilities are + in DIR/bin and the library is in DIR/lib]) + AC_ARG_WITH([Qt-include-dir], + [ --with-Qt-include-dir=DIR + Qt header files are in DIR]) + AC_ARG_WITH([Qt-bin-dir], + [ --with-Qt-bin-dir=DIR Qt utilities such as moc and uic are in DIR]) + AC_ARG_WITH([Qt-lib-dir], + [ --with-Qt-lib-dir=DIR The Qt library is in DIR]) + AC_ARG_WITH([Qt-lib], + [ --with-Qt-lib=LIB Use -lLIB to link with the Qt library]) + if test x"$with_Qt_dir" = x"no" || + test x"$with_Qt_include-dir" = x"no" || + test x"$with_Qt_bin_dir" = x"no" || + test x"$with_Qt_lib_dir" = x"no" || + test x"$with_Qt_lib" = x"no"; then + # user disabled Qt. Leave cache alone. + have_qt="User disabled Qt." + else + # "yes" is a bogus option + if test x"$with_Qt_dir" = xyes; then + with_Qt_dir= + fi + if test x"$with_Qt_include_dir" = xyes; then + with_Qt_include_dir= + fi + if test x"$with_Qt_bin_dir" = xyes; then + with_Qt_bin_dir= + fi + if test x"$with_Qt_lib_dir" = xyes; then + with_Qt_lib_dir= + fi + if test x"$with_Qt_lib" = xyes; then + with_Qt_lib= + fi + # No Qt unless we discover otherwise + have_qt=no + # Check whether we are requested to link with a specific version + if test x"$with_Qt_lib" != x; then + bnv_qt_lib="$with_Qt_lib" + fi + # Check whether we were supplied with an answer already + if test x"$with_Qt_dir" != x; then + have_qt=yes + bnv_qt_dir="$with_Qt_dir" + bnv_qt_include_dir="$with_Qt_dir/include" + bnv_qt_bin_dir="$with_Qt_dir/bin" + bnv_qt_lib_dir="$with_Qt_dir/lib" + # Only search for the lib if the user did not define one already + if test x"$bnv_qt_lib" = x; then + bnv_qt_lib="`ls $bnv_qt_lib_dir/libqt* | sed -n 1p | + sed s@$bnv_qt_lib_dir/lib@@ | [sed s@[.].*@@]`" + fi + bnv_qt_LIBS="-L$bnv_qt_lib_dir -l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS" + else + # Use cached value or do search, starting with suggestions from + # the command line + AC_CACHE_VAL(bnv_cv_have_qt, + [ + # We are not given a solution and there is no cached value. + bnv_qt_dir=NO + bnv_qt_include_dir=NO + bnv_qt_lib_dir=NO + if test x"$bnv_qt_lib" = x; then + bnv_qt_lib=NO + fi + BNV_PATH_QT_DIRECT + if test "$bnv_qt_dir" = NO || + test "$bnv_qt_include_dir" = NO || + test "$bnv_qt_lib_dir" = NO || + test "$bnv_qt_lib" = NO; then + # Problem with finding complete Qt. Cache the known absence of Qt. + bnv_cv_have_qt="have_qt=no" + else + # Record where we found Qt for the cache. + bnv_cv_have_qt="have_qt=yes \ + bnv_qt_dir=$bnv_qt_dir \ + bnv_qt_include_dir=$bnv_qt_include_dir \ + bnv_qt_bin_dir=$bnv_qt_bin_dir \ + bnv_qt_LIBS=\"$bnv_qt_LIBS\"" + fi + ])dnl + eval "$bnv_cv_have_qt" + fi # all $bnv_qt_* are set + fi # $have_qt reflects the system status + if test x"$have_qt" = xyes; then + QT_CXXFLAGS="-I$bnv_qt_include_dir" + QT_DIR="$bnv_qt_dir" + QT_LIBS="$bnv_qt_LIBS" + # If bnv_qt_dir is defined, utilities are expected to be in the + # bin subdirectory + if test x"$bnv_qt_dir" != x; then + if test -x "$bnv_qt_dir/bin/uic"; then + QT_UIC="$bnv_qt_dir/bin/uic" + else + # Old versions of Qt don't have uic + QT_UIC= + fi + QT_MOC="$bnv_qt_dir/bin/moc" + else + # Or maybe we are told where to look for the utilities + if test x"$bnv_qt_bin_dir" != x; then + if test -x "$bnv_qt_bin_dir/uic"; then + QT_UIC="$bnv_qt_bin_dir/uic" + else + # Old versions of Qt don't have uic + QT_UIC= + fi + QT_MOC="$bnv_qt_bin_dir/moc" + else + # Last possibility is that they are in $PATH + QT_UIC="`which uic`" + QT_MOC="`which moc`" + fi + fi + # All variables are defined, report the result + AC_MSG_RESULT([$have_qt: + QT_CXXFLAGS=$QT_CXXFLAGS + QT_DIR=$QT_DIR + QT_LIBS=$QT_LIBS + QT_UIC=$QT_UIC + QT_MOC=$QT_MOC]) + else + # Qt was not found + QT_CXXFLAGS= + QT_DIR= + QT_LIBS= + QT_UIC= + QT_MOC= + AC_MSG_RESULT($have_qt) + fi + AC_SUBST(QT_CXXFLAGS) + AC_SUBST(QT_DIR) + AC_SUBST(QT_LIBS) + AC_SUBST(QT_UIC) + AC_SUBST(QT_MOC) + + #### Being paranoid: + if test x"$have_qt" = xyes; then + AC_MSG_CHECKING(correct functioning of Qt installation) + AC_CACHE_VAL(bnv_cv_qt_test_result, + [ + cat > bnv_qt_test.h << EOF +#include +class Test : public QObject +{ +Q_OBJECT +public: + Test() {} + ~Test() {} +public slots: + void receive() {} +signals: + void send(); +}; +EOF + + cat > bnv_qt_main.$ac_ext << EOF +#include "bnv_qt_test.h" +#include +int main( int argc, char **argv ) +{ + QApplication app( argc, argv ); + Test t; + QObject::connect( &t, SIGNAL(send()), &t, SLOT(receive()) ); +} +EOF + + bnv_cv_qt_test_result="failure" + bnv_try_1="$QT_MOC bnv_qt_test.h -o moc_bnv_qt_test.$ac_ext >/dev/null 2>bnv_qt_test_1.out" + AC_TRY_EVAL(bnv_try_1) + bnv_err_1=`grep -v '^ *+' bnv_qt_test_1.out | grep -v "^bnv_qt_test.h\$"` + if test x"$bnv_err_1" != x; then + echo "$bnv_err_1" >&AC_FD_CC + echo "configure: could not run $QT_MOC on:" >&AC_FD_CC + cat bnv_qt_test.h >&AC_FD_CC + else + bnv_try_2="$CXX $QT_CXXFLAGS -c $CXXFLAGS -o moc_bnv_qt_test.o moc_bnv_qt_test.$ac_ext >/dev/null 2>bnv_qt_test_2.out" + AC_TRY_EVAL(bnv_try_2) + bnv_err_2=`grep -v '^ *+' bnv_qt_test_2.out | grep -v "^bnv_qt_test.{$ac_ext}\$"` + if test x"$bnv_err_2" != x; then + echo "$bnv_err_2" >&AC_FD_CC + echo "configure: could not compile:" >&AC_FD_CC + cat bnv_qt_test.$ac_ext >&AC_FD_CC + else + bnv_try_3="$CXX $QT_CXXFLAGS -c $CXXFLAGS -o bnv_qt_main.o bnv_qt_main.$ac_ext >/dev/null 2>bnv_qt_test_3.out" + AC_TRY_EVAL(bnv_try_3) + bnv_err_3=`grep -v '^ *+' bnv_qt_test_3.out | grep -v "^bnv_qt_main.{$ac_ext}\$"` + if test x"$bnv_err_3" != x; then + echo "$bnv_err_3" >&AC_FD_CC + echo "configure: could not compile:" >&AC_FD_CC + cat bnv_qt_main.$ac_ext >&AC_FD_CC + else + bnv_try_4="$CXX $QT_LIBS $LIBS -o bnv_qt_main bnv_qt_main.o moc_bnv_qt_test.o >/dev/null 2>bnv_qt_test_4.out" + AC_TRY_EVAL(bnv_try_4) + bnv_err_4=`grep -v '^ *+' bnv_qt_test_4.out` + if test x"$bnv_err_4" != x; then + echo "$bnv_err_4" >&AC_FD_CC + else + bnv_cv_qt_test_result="success" + fi + fi + fi + fi + ])dnl AC_CACHE_VAL bnv_cv_qt_test_result + AC_MSG_RESULT([$bnv_cv_qt_test_result]); + if test x"$bnv_cv_qt_test_result" = "xfailure"; then + # working Qt was not found + QT_CXXFLAGS= + QT_DIR= + QT_LIBS= + QT_UIC= + QT_MOC= + have_qt=no + AC_MSG_WARN([Failed to find matching components of a complete + Qt installation. Try using more options, + see ./configure --help.]) + fi + + rm -f bnv_qt_test.h moc_bnv_qt_test.$ac_ext moc_bnv_qt_test.o \ + bnv_qt_main.$ac_ext bnv_qt_main.o bnv_qt_main \ + bnv_qt_test_1.out bnv_qt_test_2.out bnv_qt_test_3.out bnv_qt_test_4.out + fi +]) + +dnl Internal subroutine of BNV_HAVE_QT +dnl Set bnv_qt_dir bnv_qt_include_dir bnv_qt_bin_dir bnv_qt_lib_dir bnv_qt_lib +dnl Copyright 2001 Bastiaan N. Veelo +AC_DEFUN([BNV_PATH_QT_DIRECT], +[ + ## Binary utilities ## + if test x"$with_Qt_bin_dir" != x; then + bnv_qt_bin_dir=$with_Qt_bin_dir + fi + ## Look for header files ## + if test x"$with_Qt_include_dir" != x; then + bnv_qt_include_dir="$with_Qt_include_dir" + else + # The following header file is expected to define QT_VERSION. + qt_direct_test_header=qglobal.h + # Look for the header file in a standard set of common directories. + bnv_include_path_list=" + /usr/include + `ls -dr /usr/include/qt* 2>/dev/null` + `ls -dr /usr/lib/qt*/include 2>/dev/null` + `ls -dr /usr/local/qt*/include 2>/dev/null` + `ls -dr /opt/qt*/include 2>/dev/null` + " + for bnv_dir in $bnv_include_path_list; do + if test -r "$bnv_dir/$qt_direct_test_header"; then + bnv_dirs="$bnv_dirs $bnv_dir" + fi + done + # Now look for the newest in this list + bnv_prev_ver=0 + for bnv_dir in $bnv_dirs; do + bnv_this_ver=`egrep -w '#define QT_VERSION' $bnv_dir/$qt_direct_test_header | sed s/'#define QT_VERSION'//` + if expr $bnv_this_ver '>' $bnv_prev_ver > /dev/null; then + bnv_qt_include_dir=$bnv_dir + bnv_prev_ver=$bnv_this_ver + fi + done + fi dnl Found header files. + + # Are these headers located in a traditional Trolltech installation? + # That would be $bnv_qt_include_dir stripped from its last element: + bnv_possible_qt_dir=`dirname $bnv_qt_include_dir` + if test -x $bnv_possible_qt_dir/bin/moc && + ls $bnv_possible_qt_dir/lib/libqt* > /dev/null; then + # Then the rest is a piece of cake + bnv_qt_dir=$bnv_possible_qt_dir + bnv_qt_bin_dir="$bnv_qt_dir/bin" + bnv_qt_lib_dir="$bnv_qt_dir/lib" + # Only look for lib if the user did not supply it already + if test x"$bnv_qt_lib" = xNO; then + bnv_qt_lib="`ls $bnv_qt_lib_dir/libqt* | sed -n 1p | + sed s@$bnv_qt_lib_dir/lib@@ | [sed s@[.].*@@]`" + fi + bnv_qt_LIBS="-L$bnv_qt_lib_dir -l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS" + else + # There is no valid definition for $QTDIR as Trolltech likes to see it + bnv_qt_dir= + ## Look for Qt library ## + if test x"$with_Qt_lib_dir" != x; then + bnv_qt_lib_dir="$with_Qt_lib_dir" + # Only look for lib if the user did not supply it already + if test x"$bnv_qt_lib" = xNO; then + bnv_qt_lib="`ls $bnv_qt_lib_dir/libqt* | sed -n 1p | + sed s@$bnv_qt_lib_dir/lib@@ | [sed s@[.].*@@]`" + fi + bnv_qt_LIBS="-L$bnv_qt_lib_dir -l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS" + else + # Normally, when there is no traditional Trolltech installation, + # the library is installed in a place where the linker finds it + # automatically. + # If the user did not define the library name, try with qt + if test x"$bnv_qt_lib" = xNO; then + bnv_qt_lib=qt + fi + qt_direct_test_header=qapplication.h + qt_direct_test_main=" + int argc; + char ** argv; + QApplication app(argc,argv); + " + # See if we find the library without any special options. + # Don't add top $LIBS permanently yet + bnv_save_LIBS="$LIBS" + LIBS="-l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS" + bnv_qt_LIBS="$LIBS" + bnv_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="-I$bnv_qt_include_dir" + AC_TRY_LINK([#include <$qt_direct_test_header>], + $qt_direct_test_main, + [ + # Success. + # We can link with no special library directory. + bnv_qt_lib_dir= + ], [ + # That did not work. Try the multi-threaded version + echo "Non-critical error, please neglect the above." >&AC_FD_CC + bnv_qt_lib=qt-mt + LIBS="-l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS" + AC_TRY_LINK([#include <$qt_direct_test_header>], + $qt_direct_test_main, + [ + # Success. + # We can link with no special library directory. + bnv_qt_lib_dir= + ], [ + # That did not work. Try the OpenGL version + echo "Non-critical error, please neglect the above." >&AC_FD_CC + bnv_qt_lib=qt-gl + LIBS="-l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS" + AC_TRY_LINK([#include <$qt_direct_test_header>], + $qt_direct_test_main, + [ + # Succes. + # We can link with no special library directory. + bnv_qt_lib_dir= + ], [ + # That did not work. Maybe a library version I don't know about? + echo "Non-critical error, please neglect the above." >&AC_FD_CC + # Look for some Qt lib in a standard set of common directories. + bnv_dir_list=" + `echo $bnv_qt_includes | sed ss/includess` + /lib + /usr/lib + /usr/local/lib + /opt/lib + `ls -dr /usr/lib/qt* 2>/dev/null` + `ls -dr /usr/local/qt* 2>/dev/null` + `ls -dr /opt/qt* 2>/dev/null` + " + for bnv_dir in $bnv_dir_list; do + if ls $bnv_dir/libqt*; then + # Gamble that it's the first one... + bnv_qt_lib="`ls $bnv_dir/libqt* | sed -n 1p | + sed s@$bnv_dir/lib@@ | sed s/[.].*//`" + bnv_qt_lib_dir="$bnv_dir" + break + fi + done + # Try with that one + LIBS="-l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS" + AC_TRY_LINK([#include <$qt_direct_test_header>], + $qt_direct_test_main, + [ + # Succes. + # We can link with no special library directory. + bnv_qt_lib_dir= + ], [ + # Leave bnv_qt_lib_dir defined + ]) + ]) + ]) + ]) + if test x"$bnv_qt_lib_dir" != x; then + bnv_qt_LIBS="-l$bnv_qt_lib_dir $LIBS" + else + bnv_qt_LIBS="$LIBS" + fi + LIBS="$bnv_save_LIBS" + CXXFLAGS="$bnv_save_CXXFLAGS" + fi dnl $with_Qt_lib_dir was not given + fi dnl Done setting up for non-traditional Trolltech installation +]) diff --git a/imbe_vocoder/config/cppunit.m4 b/imbe_vocoder/config/cppunit.m4 new file mode 100644 index 0000000..0991d51 --- /dev/null +++ b/imbe_vocoder/config/cppunit.m4 @@ -0,0 +1,80 @@ +dnl +dnl AM_PATH_CPPUNIT(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl +AC_DEFUN([AM_PATH_CPPUNIT], +[ + +AC_ARG_WITH(cppunit-prefix,[ --with-cppunit-prefix=PFX Prefix where CppUnit is installed (optional)], + cppunit_config_prefix="$withval", cppunit_config_prefix="") +AC_ARG_WITH(cppunit-exec-prefix,[ --with-cppunit-exec-prefix=PFX Exec prefix where CppUnit is installed (optional)], + cppunit_config_exec_prefix="$withval", cppunit_config_exec_prefix="") + + if test x$cppunit_config_exec_prefix != x ; then + cppunit_config_args="$cppunit_config_args --exec-prefix=$cppunit_config_exec_prefix" + if test x${CPPUNIT_CONFIG+set} != xset ; then + CPPUNIT_CONFIG=$cppunit_config_exec_prefix/bin/cppunit-config + fi + fi + if test x$cppunit_config_prefix != x ; then + cppunit_config_args="$cppunit_config_args --prefix=$cppunit_config_prefix" + if test x${CPPUNIT_CONFIG+set} != xset ; then + CPPUNIT_CONFIG=$cppunit_config_prefix/bin/cppunit-config + fi + fi + + AC_PATH_PROG(CPPUNIT_CONFIG, cppunit-config, no) + cppunit_version_min=$1 + + AC_MSG_CHECKING(for Cppunit - version >= $cppunit_version_min) + no_cppunit="" + if test "$CPPUNIT_CONFIG" = "no" ; then + no_cppunit=yes + else + CPPUNIT_CFLAGS=`$CPPUNIT_CONFIG --cflags` + CPPUNIT_LIBS=`$CPPUNIT_CONFIG --libs` + cppunit_version=`$CPPUNIT_CONFIG --version` + + cppunit_major_version=`echo $cppunit_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + cppunit_minor_version=`echo $cppunit_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + cppunit_micro_version=`echo $cppunit_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + + cppunit_major_min=`echo $cppunit_version_min | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + cppunit_minor_min=`echo $cppunit_version_min | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + cppunit_micro_min=`echo $cppunit_version_min | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + + cppunit_version_proper=`expr \ + $cppunit_major_version \> $cppunit_major_min \| \ + $cppunit_major_version \= $cppunit_major_min \& \ + $cppunit_minor_version \> $cppunit_minor_min \| \ + $cppunit_major_version \= $cppunit_major_min \& \ + $cppunit_minor_version \= $cppunit_minor_min \& \ + $cppunit_micro_version \>= $cppunit_micro_min ` + + if test "$cppunit_version_proper" = "1" ; then + AC_MSG_RESULT([$cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version]) + else + AC_MSG_RESULT(no) + no_cppunit=yes + fi + fi + + if test "x$no_cppunit" = x ; then + ifelse([$2], , :, [$2]) + else + CPPUNIT_CFLAGS="" + CPPUNIT_LIBS="" + ifelse([$3], , :, [$3]) + fi + + AC_SUBST(CPPUNIT_CFLAGS) + AC_SUBST(CPPUNIT_LIBS) +]) + + + diff --git a/imbe_vocoder/config/gr_as.m4 b/imbe_vocoder/config/gr_as.m4 new file mode 100644 index 0000000..a069547 --- /dev/null +++ b/imbe_vocoder/config/gr_as.m4 @@ -0,0 +1,34 @@ +# Figure out how to run the assembler. -*- Autoconf -*- + +# serial 2 + +# Copyright 2001 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., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# I just copy and renamed this from automake-1.6.3 so we should work +# under both 1.4-p6 and later. -eb + +# GR_PROG_AS +# ---------- +AC_DEFUN([GR_PROG_AS], +[# By default we simply use the C compiler to build assembly code. +AC_REQUIRE([AC_PROG_CC]) +: ${CCAS='$(CC)'} +# Set ASFLAGS if not already set. +: ${CCASFLAGS='$(CFLAGS)'} +AC_SUBST(CCAS) +AC_SUBST(CCASFLAGS)]) diff --git a/imbe_vocoder/config/gr_boost.m4 b/imbe_vocoder/config/gr_boost.m4 new file mode 100644 index 0000000..b1751c0 --- /dev/null +++ b/imbe_vocoder/config/gr_boost.m4 @@ -0,0 +1,111 @@ +dnl +dnl Copyright 2004,2005 Free Software Foundation, Inc. +dnl +dnl This file is part of GNU Radio +dnl +dnl GNU Radio is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2, or (at your option) +dnl any later version. +dnl +dnl GNU Radio is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with GNU Radio; see the file COPYING. If not, write to +dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +dnl Boston, MA 02111-1307, USA. +dnl + +dnl This tries to do the "right thing" to locate the boost include files. +dnl If the user explicitly specified --with-boost-include-dir= +dnl we believe them and use it. Otherwise, +dnl +dnl We look for boost/shared_ptr.hpp in the "normal places". That is, +dnl wherever AC_CHECK_HEADER looks. If the boost includes are in /usr/local/include +dnl this step will find them. +dnl +dnl Otherwise, we check to see if the boost stuff was installed in a version-specific +dnl directory under /usr/local/include. These look like: /usr/local/include/boost-1_33_1 +dnl If there's more than one version installed, we select the +dnl lexicographically greatest one. +dnl +dnl If none of these work, we bail. + +AC_DEFUN([GR_REQUIRE_BOOST_INCLUDES], +[ + AC_LANG_PUSH(C++) + gr_boost_include_dir= + AC_ARG_WITH([boost-include-dir], + AC_HELP_STRING([--with-boost-include-dir=], + [path to boost c++ include files]), + [ + # "yes" and "no" are bogus answers + if test x"$with_boost_include_dir" == xyes || + test x"$with_boost_include_dir" == xno; then + gr_boost_include_dir= + else + gr_boost_include_dir=$with_boost_include_dir + fi + ]) + echo "gr_boost_include_dir = $gr_boost_include_dir" + if test x$gr_boost_include_dir != x; then + # + # If the user specified a directory, then we use it + # + OLD_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS -I$gr_boost_include_dir" + AC_CHECK_HEADER([boost/shared_ptr.hpp], + [BOOST_CFLAGS="-I$gr_boost_include_dir"], + [AC_MSG_ERROR( + [Failed to locate boost/shared_ptr.hpp. +Try using --with-boost-include-dir=, +E.g., --with-boost-include-dir=/usr/local/include/boost-1_33_1])]) + CPPFLAGS=$OLD_CPPFLAGS + else + # + # Otherwise we check in the default places + # + AC_CHECK_HEADER([boost/shared_ptr.hpp], + [BOOST_CFLAGS=""], + [ # Nope, look for latest version if any in $prefix/include/boost-* + + # Wipe out cached value. KLUDGE: AC should have API for this + unset AS_TR_SH([ac_cv_header_boost/shared_ptr.hpp]) + + boost_last_match(){ + #echo "boost_last_match: [$]*" + pattern="[$]1" + shift + if test "[$]pattern" = "[$]1" + then + LM='' + else + shift `expr [$]# - 1` + LM=[$]1 + fi + #echo "LM(1)='[$]LM'" + } + + pattern="/usr/local/include/boost-*" + boost_last_match "$pattern" $pattern + #echo "LM(2)='$LM'" + + OLD_CPPFLAGS=$CPP_FLAGS + CPPFLAGS="$CPPFLAGS -I$LM" + AC_CHECK_HEADER([boost/shared_ptr.hpp], + [BOOST_CFLAGS="-I$LM"], + [AC_MSG_ERROR( + [Failed to locate boost/shared_ptr.hpp. +Try using --with-boost-include-dir=, +E.g., --with-boost-include-dir=/usr/local/include/boost-1_33_1])]) + CPPFLAGS=$OLD_CPPFLAGS + ]) + + fi + unset boost_last_match LM + AC_LANG_POP + AC_SUBST(BOOST_CFLAGS) +]) diff --git a/imbe_vocoder/config/gr_check_createfilemapping.m4 b/imbe_vocoder/config/gr_check_createfilemapping.m4 new file mode 100644 index 0000000..9cb94f5 --- /dev/null +++ b/imbe_vocoder/config/gr_check_createfilemapping.m4 @@ -0,0 +1,52 @@ +dnl +dnl Copyright 2005 Free Software Foundation, Inc. +dnl +dnl This file is part of GNU Radio +dnl +dnl GNU Radio is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2, or (at your option) +dnl any later version. +dnl +dnl GNU Radio is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with GNU Radio; see the file COPYING. If not, write to +dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +dnl Boston, MA 02111-1307, USA. + +dnl AC_DEFUN([GR_CHECK_CREATEFILEMAPPING], +dnl [ +dnl AC_CHECK_FUNCS([CreateFileMapping]) +dnl ]) + +AC_DEFUN([GR_CHECK_CREATEFILEMAPPING],[ + AC_MSG_CHECKING([for CreateFileMapping function]) + AC_COMPILE_IFELSE([ +#include +int main (int argc, char **argv) +{ + HANDLE handle; + int size; + char seg_name[[1024]]; + handle = CreateFileMapping( + INVALID_HANDLE_VALUE, // use paging file + NULL, // default security + PAGE_READWRITE, // read/write access + 0, // max. object size + size, // buffer size + seg_name); // name of mapping object + return 0; +} +],[HAVE_CREATEFILEMAPPING=yes + AC_DEFINE(HAVE_CREATEFILEMAPPING,[1],[Define if you have the CreateFilemapping function(win32).])], + [HAVE_CREATEFILEMAPPING=no]) + + AC_MSG_RESULT($HAVE_CREATEFILEMAPPING) + AM_CONDITIONAL(HAVE_CREATEFILEMAPPING, test x$HAVE_CREATEFILEMAPPING = xyes) +]) + + diff --git a/imbe_vocoder/config/gr_check_mc4020.m4 b/imbe_vocoder/config/gr_check_mc4020.m4 new file mode 100644 index 0000000..0c4318e --- /dev/null +++ b/imbe_vocoder/config/gr_check_mc4020.m4 @@ -0,0 +1,37 @@ +dnl +dnl Copyright 2003 Free Software Foundation, Inc. +dnl +dnl This file is part of GNU Radio +dnl +dnl GNU Radio is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2, or (at your option) +dnl any later version. +dnl +dnl GNU Radio is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with GNU Radio; see the file COPYING. If not, write to +dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +dnl Boston, MA 02111-1307, USA. +dnl + +AC_DEFUN([GR_CHECK_MC4020],[ + AC_MSG_CHECKING([for mc4020 A/D driver include file]) + AC_COMPILE_IFELSE([ +#include +int main (int argc, char **argv) +{ + return 0; +} +],[HAVE_MC4020=yes + AC_DEFINE(HAVE_MC4020,[1],[Define if you have a Measurement Computing PCI-DAS4020/12 A/D])], + [HAVE_MC4020=no]) + + AC_MSG_RESULT($HAVE_MC4020) + AM_CONDITIONAL(HAVE_MC4020, test x$HAVE_MC4020 = xyes) +]) + diff --git a/imbe_vocoder/config/gr_check_shm_open.m4 b/imbe_vocoder/config/gr_check_shm_open.m4 new file mode 100644 index 0000000..27c9ee6 --- /dev/null +++ b/imbe_vocoder/config/gr_check_shm_open.m4 @@ -0,0 +1,29 @@ +dnl +dnl Copyright 2003 Free Software Foundation, Inc. +dnl +dnl This file is part of GNU Radio +dnl +dnl GNU Radio is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2, or (at your option) +dnl any later version. +dnl +dnl GNU Radio is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with GNU Radio; see the file COPYING. If not, write to +dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +dnl Boston, MA 02111-1307, USA. + +AC_DEFUN([GR_CHECK_SHM_OPEN], +[ + SHM_OPEN_LIBS="" + save_LIBS="$LIBS" + AC_SEARCH_LIBS([shm_open], [rt], [SHM_OPEN_LIBS="$LIBS"]) + AC_CHECK_FUNCS([shm_open]) + LIBS="$save_LIBS" + AC_SUBST(SHM_OPEN_LIBS) +]) diff --git a/imbe_vocoder/config/gr_check_usrp.m4 b/imbe_vocoder/config/gr_check_usrp.m4 new file mode 100644 index 0000000..b818a69 --- /dev/null +++ b/imbe_vocoder/config/gr_check_usrp.m4 @@ -0,0 +1,32 @@ +dnl +dnl Copyright 2003 Free Software Foundation, Inc. +dnl +dnl This file is part of GNU Radio +dnl +dnl GNU Radio is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2, or (at your option) +dnl any later version. +dnl +dnl GNU Radio is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with GNU Radio; see the file COPYING. If not, write to +dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +dnl Boston, MA 02111-1307, USA. +dnl + +dnl Check for Universal Software Radio Peripheral + +AC_DEFUN([GR_CHECK_USRP],[ + PKG_CHECK_MODULES(USRP, usrp >= 0.2, + [HAVE_USRP=yes + AC_DEFINE(HAVE_USRP,[1],[Define if you have a USRP])], + [HAVE_USRP=no]) + + AM_CONDITIONAL(HAVE_USRP, test x$HAVE_USRP = xyes) +]) + diff --git a/imbe_vocoder/config/gr_doxygen.m4 b/imbe_vocoder/config/gr_doxygen.m4 new file mode 100644 index 0000000..82aea35 --- /dev/null +++ b/imbe_vocoder/config/gr_doxygen.m4 @@ -0,0 +1,59 @@ +dnl +dnl Copyright 2003,2005 Free Software Foundation, Inc. +dnl +dnl This file is part of GNU Radio +dnl +dnl GNU Radio is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2, or (at your option) +dnl any later version. +dnl +dnl GNU Radio is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with GNU Radio; see the file COPYING. If not, write to +dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +dnl Boston, MA 02111-1307, USA. +dnl + +AC_DEFUN([GR_CHECK_DOXYGEN],[ + AC_ARG_ENABLE(doxygen, [ --enable-doxygen enable documentation generation with doxygen (no)]) + AC_ARG_ENABLE(dot, [ --enable-dot use 'dot' to generate graphs in doxygen (auto)]) + AC_ARG_ENABLE(html-docs, [ --enable-html-docs enable HTML generation with doxygen (yes)], [], [ enable_html_docs=yes]) + AC_ARG_ENABLE(latex-docs, [ --enable-latex-docs enable LaTeX doc generation with doxygen (no)], [], [ enable_latex_docs=no]) + + if test "x$enable_doxygen" = xyes; then + AC_PATH_PROG(DOXYGEN, doxygen, , $PATH) + if test x$DOXYGEN = x; then + if test "x$enable_doxygen" = xyes; then + AC_MSG_ERROR([could not find doxygen]) + fi + enable_doc=no + generate_docs= + else + enable_doc=yes + generate_docs=docs + AC_PATH_PROG(DOT, dot, , $PATH) + fi + else + enable_doc=no + fi + + AM_CONDITIONAL(DOC, test x$enable_doc = xyes) + + if test x$DOT = x; then + if test "x$enable_dot" = xyes; then + AC_MSG_ERROR([could not find dot]) + fi + enable_dot=no + else + enable_dot=yes + fi + AC_SUBST(enable_dot) + AC_SUBST(enable_html_docs) + AC_SUBST(enable_latex_docs) + AC_SUBST(generate_docs) +]) diff --git a/imbe_vocoder/config/gr_gprof.m4 b/imbe_vocoder/config/gr_gprof.m4 new file mode 100644 index 0000000..cc50508 --- /dev/null +++ b/imbe_vocoder/config/gr_gprof.m4 @@ -0,0 +1,72 @@ +dnl +dnl Copyright 2002 Free Software Foundation, Inc. +dnl +dnl This file is part of GNU Radio +dnl +dnl GNU Radio is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2, or (at your option) +dnl any later version. +dnl +dnl GNU Radio is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with GNU Radio; see the file COPYING. If not, write to +dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +dnl Boston, MA 02111-1307, USA. +dnl + +dnl FIXME probably need to add linker flag too... + +AC_DEFUN([GR_SET_GPROF],[ + dnl Check for --with-gprof + AC_MSG_CHECKING([whether user wants gprof]) + AC_ARG_WITH(gprof, + [ --with-gprof Turn on gprof profiling], + [], [ with_gprof=no ]) + AC_MSG_RESULT($with_gprof) + + dnl gprof profiling flags for the two main compilers + cc_profiling_flags="-pg" + cxx_profiling_flags="-pg" + ld_profiling_flags="-pg" + if test $with_gprof = yes + then + if test -n "${CC}" + then + LF_CHECK_CC_FLAG($cc_profiling_flags) + fi + if test -n "${CXX}" + then + LF_CHECK_CXX_FLAG($cxx_profiling_flags) + fi + fi +]) + +AC_DEFUN([GR_SET_PROF],[ + dnl Check for --with-prof + AC_MSG_CHECKING([whether user wants prof]) + AC_ARG_WITH(prof, + [ --with-prof Turn on prof profiling], + [], [ with_prof=no ]) + AC_MSG_RESULT($with_prof) + + dnl prof profiling flags for the two main compilers + cc_profiling_flags="-p" + cxx_profiling_flags="-p" + ld_profiling_flags="-p" + if test $with_prof = yes + then + if test -n "${CC}" + then + LF_CHECK_CC_FLAG($cc_profiling_flags) + fi + if test -n "${CXX}" + then + LF_CHECK_CXX_FLAG($cxx_profiling_flags) + fi + fi +]) diff --git a/imbe_vocoder/config/gr_libgnuradio_core_extra_ldflags.m4 b/imbe_vocoder/config/gr_libgnuradio_core_extra_ldflags.m4 new file mode 100644 index 0000000..491f7a0 --- /dev/null +++ b/imbe_vocoder/config/gr_libgnuradio_core_extra_ldflags.m4 @@ -0,0 +1,40 @@ +# Check for (MinGW)win32 extra ld options. -*- Autoconf -*- + +# Copyright 2003,2004,2005 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +dnl +AC_DEFUN([GR_LIBGNURADIO_CORE_EXTRA_LDFLAGS], [ +AC_REQUIRE([AC_PROG_LD]) +# on Mingw32 extra LDFLAGS are required to ease global variable linking +LIBGNURADIO_CORE_EXTRA_LDFLAGS="" + +AC_MSG_CHECKING([whether $LD accepts --enable-runtime-pseudo-reloc]) +if ${LD} --enable-runtime-pseudo-reloc --version >/dev/null 2>&1 +then + # libtool requires the quotes + LIBGNURADIO_CORE_EXTRA_LDFLAGS="\"-Wl,--enable-runtime-pseudo-reloc\"" + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi + +AC_SUBST(LIBGNURADIO_CORE_EXTRA_LDFLAGS) + +]) diff --git a/imbe_vocoder/config/gr_no_undefined.m4 b/imbe_vocoder/config/gr_no_undefined.m4 new file mode 100644 index 0000000..8780fab --- /dev/null +++ b/imbe_vocoder/config/gr_no_undefined.m4 @@ -0,0 +1,44 @@ +dnl +dnl Copyright 2005 Free Software Foundation, Inc. +dnl +dnl This file is part of GNU Radio +dnl +dnl GNU Radio is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2, or (at your option) +dnl any later version. +dnl +dnl GNU Radio is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with GNU Radio; see the file COPYING. If not, write to +dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +dnl Boston, MA 02111-1307, USA. +dnl + +# GR_NO_UNDEFINED() +# +# Detemine whether we need to use the -no-undefined linker flag +# when building shared libraries. +# Sets NO_UNDEFINED to "" or "-no-undefined" +# +# As far as I can tell, we need -no-undefined only when building +# windows DLLs. This occurs when using MinGW and Cygwin. +# +# For now, we stub this out. + +AC_DEFUN([GR_NO_UNDEFINED],[ + AC_REQUIRE([AC_CANONICAL_HOST]) + no_undefined="" + case "${host_os}" in + *mingw* | *cygwin*) + + # on MinGW/Cygwin extra LDFLAGS are required + no_undefined="-no-undefined" + ;; + esac + AC_SUBST(NO_UNDEFINED,[$no_undefined]) +]) diff --git a/imbe_vocoder/config/gr_omnithread.m4 b/imbe_vocoder/config/gr_omnithread.m4 new file mode 100644 index 0000000..7c3150b --- /dev/null +++ b/imbe_vocoder/config/gr_omnithread.m4 @@ -0,0 +1,51 @@ +# Check for Omnithread (pthread/NT) thread support. -*- Autoconf -*- + +# Copyright 2003 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., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +AC_DEFUN([GR_OMNITHREAD], +[ + # Check first for POSIX + ACX_PTHREAD( + [ ot_posix="yes" + AC_DEFINE(OMNITHREAD_POSIX,[1],[Define to 1 to enable pthread]) + ],[ + # If no POSIX support found, then check for NT threads + AC_MSG_CHECKING([for NT threads]) + + AC_LINK_IFELSE([ + #include + #include + int main() { InitializeCriticalSection(NULL); return 0; } + ], + [ + ot_nt="yes" + AC_DEFINE(OMNITHREAD_NT,[1],[Define to 1 to enable NT thread]) + ], + [AC_MSG_FAILURE([GNU Radio requires POSIX threads. pthreads not found.])] + ) + AC_MSG_RESULT(yes) + ]) + AM_CONDITIONAL(OMNITHREAD_POSIX, test "x$ot_posix" = xyes) + AM_CONDITIONAL(OMNITHREAD_NT, test "x$ot_nt" = xyes) + + save_LIBS="$LIBS" + AC_SEARCH_LIBS([clock_gettime], [rt], [PTHREAD_LIBS="$PTHREAD_LIBS $LIBS"]) + AC_CHECK_FUNCS([clock_gettime gettimeofday nanosleep]) + LIBS="$save_LIBS" +]) + diff --git a/imbe_vocoder/config/gr_pwin32.m4 b/imbe_vocoder/config/gr_pwin32.m4 new file mode 100644 index 0000000..5f748af --- /dev/null +++ b/imbe_vocoder/config/gr_pwin32.m4 @@ -0,0 +1,146 @@ +# Check for (mingw)win32 POSIX replacements. -*- Autoconf -*- + +# Copyright 2003,2004,2005 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + + +AC_DEFUN([GR_PWIN32], +[ +AC_REQUIRE([AC_HEADER_TIME]) +AC_CHECK_HEADERS([sys/types.h fcntl.h io.h]) +AC_CHECK_HEADERS([windows.h]) +AC_CHECK_HEADERS([winioctl.h winbase.h], [], [], [ + #if HAVE_WINDOWS_H + #include + #endif +]) + +AC_CHECK_FUNCS([getopt usleep gettimeofday nanosleep rand srand random srandom sleep sigaction]) +AC_CHECK_TYPES([struct timezone, struct timespec, ssize_t],[],[],[ + #if HAVE_SYS_TYPES_H + # include + #endif + #if TIME_WITH_SYS_TIME + # include + # include + #else + # if HAVE_SYS_TIME_H + # include + # else + # include + # endif + #endif +]) + +dnl Checks for replacements +AC_REPLACE_FUNCS([getopt usleep gettimeofday]) + + +AC_MSG_CHECKING(for Sleep) +AC_TRY_LINK([ #include + #include + ], [ Sleep(0); ], + [AC_DEFINE(HAVE_SSLEEP,1,[Define to 1 if you have win32 Sleep]) + AC_MSG_RESULT(yes)], + AC_MSG_RESULT(no) + ) + +dnl Under Win32, mkdir prototype in io.h has only one arg +AC_MSG_CHECKING(whether mkdir accepts only one arg) +AC_TRY_COMPILE([#include + #include + #include ], [ + mkdir("") + ], [ AC_MSG_RESULT(yes) + AC_DEFINE(MKDIR_TAKES_ONE_ARG,[],[Define if mkdir accepts only one arg]) ], + [ AC_MSG_RESULT(no) + ]) + +AH_BOTTOM( +[ +/* Define missing prototypes, implemented in replacement lib */ +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef HAVE_GETOPT +int getopt (int argc, char * const argv[], const char * optstring); +extern char * optarg; +extern int optind, opterr, optopt; +#endif + +#ifndef HAVE_USLEEP +int usleep(unsigned long usec); /* SUSv2 */ +#endif + +#ifndef HAVE_NANOSLEEP +#ifndef HAVE_STRUCT_TIMESPEC +#if HAVE_SYS_TYPES_H +# include /* need time_t */ +#endif +struct timespec { + time_t tv_sec; + long tv_nsec; +}; +#endif +static inline int nanosleep(const struct timespec *req, struct timespec *rem) { return usleep(req->tv_sec*1000000+req->tv_nsec/1000); } +#endif + +#if defined(HAVE_SSLEEP) && !defined(HAVE_SLEEP) +#ifdef HAVE_WINBASE_H +#include +#include +#endif +/* TODO: what about SleepEx? */ +static inline unsigned int sleep (unsigned int nb_sec) { Sleep(nb_sec*1000); return 0; } +#endif + +#ifndef HAVE_GETTIMEOFDAY +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifndef HAVE_STRUCT_TIMEZONE +struct timezone { + int tz_minuteswest; + int tz_dsttime; +}; +#endif +int gettimeofday(struct timeval *tv, struct timezone *tz); +#endif + +#if !defined(HAVE_RANDOM) && defined(HAVE_RAND) +#include +static inline long int random (void) { return rand(); } +#endif + +#if !defined(HAVE_SRANDOM) && defined(HAVE_SRAND) +static inline void srandom (unsigned int seed) { srand(seed); } +#endif + +#ifndef HAVE_SSIZE_T +typedef size_t ssize_t; +#endif + +#ifdef __cplusplus +} +#endif +]) + + +]) diff --git a/imbe_vocoder/config/gr_python.m4 b/imbe_vocoder/config/gr_python.m4 new file mode 100644 index 0000000..760a0f7 --- /dev/null +++ b/imbe_vocoder/config/gr_python.m4 @@ -0,0 +1,116 @@ +dnl +dnl Copyright 2003,2004,2005 Free Software Foundation, Inc. +dnl +dnl This file is part of GNU Radio +dnl +dnl GNU Radio is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2, or (at your option) +dnl any later version. +dnl +dnl GNU Radio is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with GNU Radio; see the file COPYING. If not, write to +dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +dnl Boston, MA 02111-1307, USA. +dnl + +# PYTHON_DEVEL() +# +# Checks for Python and tries to get the include path to 'Python.h'. +# It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS) output variables. +# +AC_DEFUN([PYTHON_DEVEL],[ + AC_REQUIRE([AM_PATH_PYTHON]) + AC_REQUIRE([AC_CANONICAL_HOST]) + + # Check for Python include path + AC_MSG_CHECKING([for Python include path]) + if test -z "$PYTHON" ; then + AC_MSG_ERROR([cannot find Python path]) + fi + + # ask distutils which include path we should use + python_cmd=' +import distutils.sysconfig +import os +path = distutils.sysconfig.get_python_inc(plat_specific=False) +if os.sep == "\\": + path = path.replace("\\", "/") +print path +' + python_path=`$PYTHON -c "$python_cmd"` + AC_MSG_RESULT([$python_path]) + if test -z "$python_path" ; then + AC_MSG_ERROR([cannot find Python include path]) + fi + + AC_SUBST(PYTHON_CPPFLAGS,[-I$python_path]) + + # Check for Python headers usability + python_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS" + AC_CHECK_HEADERS([Python.h], [], + [AC_MSG_ERROR([cannot find usable Python headers])]) + CPPFLAGS="$python_save_CPPFLAGS" + + # Only set this on mingw and cygwin hosts, (only implemented + # for mingw host, for crosscompiling you need to trick this) + + PYTHON_LDFLAGS="" + case $host_os in + *mingw* | *cygwin* ) + AC_MSG_CHECKING([for Python LDFLAGS]) + + python_cmd=' +import distutils.sysconfig +import os +path = distutils.sysconfig.get_config_var("LIBPL") +if path == None: + path = distutils.sysconfig.PREFIX + "/libs" +if os.sep == "\\": + path = path.replace("\\", "/") +print path +' + python_stdlib_path=`$PYTHON -c "$python_cmd"` + + python_version_nodot=`echo $PYTHON_VERSION | sed "s,\.,,"` + libpython_name="python$PYTHON_VERSION" + + # Standard install of python for win32 has libpython24.a + # instead of libpython2.4.a so we check for the library + # without the dot in the version number. + + python_stdlib_filename=`find $python_stdlib_path -type f -name libpython$python_version_nodot.* -print | sed "1q"` + if test -n "$python_stdlib_filename" ; then + libpython_name="python$python_version_nodot" + fi + + PYTHON_LDFLAGS="-L$python_stdlib_path -l$libpython_name" + AC_MSG_RESULT($PYTHON_LDFLAGS) + # Replace all backslashes in PYTHON Paths with forward slashes + AC_MSG_CHECKING([for pythondir]) + pythondir=`echo $pythondir |sed 's,\\\\,/,g'` + AC_MSG_RESULT($pythondir) + AC_SUBST([pythondir]) + AC_MSG_CHECKING([for pkgpythondir]) + pkgpythondir=`echo $pkgpythondir |sed 's,\\\\,/,g'` + AC_MSG_RESULT($pkgpythondir) + AC_SUBST([pkgpythondir]) + AC_MSG_CHECKING([for pyexecdir]) + pyexecdir=`echo $pyexecdir |sed 's,\\\\,/,g'` + AC_MSG_RESULT($pyexecdir) + AC_SUBST([pyexecdir]) + AC_MSG_CHECKING([for pkgpyexecdir]) + pkgpyexecdir=`echo $pkgpyexecdir |sed 's,\\\\,/,g'` + AC_MSG_RESULT($pkgpyexecdir) + AC_SUBST([pkgpyexecdir]) + ;; + esac + + AC_SUBST([PYTHON_LDFLAGS]) +]) diff --git a/imbe_vocoder/config/gr_require_mc4020.m4 b/imbe_vocoder/config/gr_require_mc4020.m4 new file mode 100644 index 0000000..8a03eeb --- /dev/null +++ b/imbe_vocoder/config/gr_require_mc4020.m4 @@ -0,0 +1,33 @@ +dnl +dnl Copyright 2003,2004 Free Software Foundation, Inc. +dnl +dnl This file is part of GNU Radio +dnl +dnl GNU Radio is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2, or (at your option) +dnl any later version. +dnl +dnl GNU Radio is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with GNU Radio; see the file COPYING. If not, write to +dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +dnl Boston, MA 02111-1307, USA. +dnl + +AC_DEFUN([GR_REQUIRE_MC4020],[ + AC_MSG_CHECKING([for mc4020 A/D driver include file]) + AC_COMPILE_IFELSE([ +#include +int main (int argc, char **argv) +{ + return 0; +} +],[AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AC_MSG_ERROR([mc4020.h not found.])]) +]) diff --git a/imbe_vocoder/config/gr_scripting.m4 b/imbe_vocoder/config/gr_scripting.m4 new file mode 100644 index 0000000..7f3abde --- /dev/null +++ b/imbe_vocoder/config/gr_scripting.m4 @@ -0,0 +1,30 @@ +dnl +dnl Copyright 2003 Free Software Foundation, Inc. +dnl +dnl This file is part of GNU Radio +dnl +dnl GNU Radio is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2, or (at your option) +dnl any later version. +dnl +dnl GNU Radio is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with GNU Radio; see the file COPYING. If not, write to +dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +dnl Boston, MA 02111-1307, USA. +dnl + +AC_DEFUN([GR_SCRIPTING],[ + AC_REQUIRE([AC_PROG_LN_S]) + AC_REQUIRE([AC_PROG_CXX]) + AC_REQUIRE([AC_PROG_LIBTOOL]) + + SWIG_PROG(1.3.23) + SWIG_ENABLE_CXX + SWIG_PYTHON +]) diff --git a/imbe_vocoder/config/gr_set_md_cpu.m4 b/imbe_vocoder/config/gr_set_md_cpu.m4 new file mode 100644 index 0000000..1bb2f34 --- /dev/null +++ b/imbe_vocoder/config/gr_set_md_cpu.m4 @@ -0,0 +1,44 @@ +dnl +dnl Copyright 2003 Free Software Foundation, Inc. +dnl +dnl This file is part of GNU Radio +dnl +dnl GNU Radio is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2, or (at your option) +dnl any later version. +dnl +dnl GNU Radio is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with GNU Radio; see the file COPYING. If not, write to +dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +dnl Boston, MA 02111-1307, USA. +dnl + +AC_DEFUN([GR_SET_MD_CPU],[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_ARG_WITH(md-cpu, + [ --with-md-cpu=ARCH set machine dependent speedups (auto)], + [cf_with_md_cpu="$withval"], + [cf_with_md_cpu="$host_cpu"]) + + AC_MSG_CHECKING([for machine dependent speedups]) + case "$cf_with_md_cpu" in + x86 | i[[3-7]]86) MD_CPU=x86 MD_SUBCPU=x86 ;; + x86_64) MD_CPU=x86 MD_SUBCPU=x86_64 ;; +# sparc) MD_CPU=sparc ;; + *) MD_CPU=generic ;; + esac + AC_MSG_RESULT($MD_CPU) + AC_SUBST(MD_CPU) + AC_SUBST(MD_SUBCPU) + + AM_CONDITIONAL(MD_CPU_x86, test $MD_CPU = x86) + AM_CONDITIONAL(MD_SUBCPU_x86_64, test $MD_SUBCPU = x86_64) + AM_CONDITIONAL(MD_CPU_generic, test $MD_CPU = generic) +]) + diff --git a/imbe_vocoder/config/gr_swig.m4 b/imbe_vocoder/config/gr_swig.m4 new file mode 100644 index 0000000..a587c6d --- /dev/null +++ b/imbe_vocoder/config/gr_swig.m4 @@ -0,0 +1,85 @@ +dnl +dnl Copyright 2003 Free Software Foundation, Inc. +dnl +dnl This file is part of GNU Radio +dnl +dnl GNU Radio is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2, or (at your option) +dnl any later version. +dnl +dnl GNU Radio is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with GNU Radio; see the file COPYING. If not, write to +dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +dnl Boston, MA 02111-1307, USA. +dnl + +# SWIG_PROG([required-version]) +# +# Checks for the SWIG program. If found you can (and should) call SWIG via $(SWIG). +# You can use the optional first argument to check if the version of the available SWIG +# is greater or equal to the value of the argument. It should have the format: +# N[.N[.N]] (N is a number between 0 and 999. Only the first N is mandatory.) +AC_DEFUN([SWIG_PROG],[ + AC_REQUIRE([AC_PROG_MAKE_SET]) + AC_CHECK_PROG(SWIG,swig,[`which swig`]) + if test -z "$SWIG" ; then + AC_MSG_ERROR([Cannot find 'swig' program. SWIG version >= $1 required]) + SWIG=false + elif test -n "$1" ; then + AC_MSG_CHECKING([for SWIG version]) + swig_version=`$SWIG -version 2>&1 | \ + awk '/^SWIG Version [[0-9]+\.[0-9]+\.[0-9]]+.*$/ { split($[3],a,"[[^.0-9]]"); print a[[1]] }'` + AC_MSG_RESULT([$swig_version]) + if test -n "$swig_version" ; then + swig_version=`echo $swig_version | \ + awk '{ split($[1],a,"\."); print [a[1]*1000000+a[2]*1000+a[3]] }' 2>/dev/null` + swig_required_version=`echo $1 | \ + awk '{ split($[1],a,"\."); print [a[1]*1000000+a[2]*1000+a[3]] }' 2>/dev/null` + if test $swig_required_version -gt $swig_version ; then + AC_MSG_ERROR([SWIG version >= $1 required]) + fi + else + AC_MSG_ERROR([cannot determine SWIG version]) + fi + fi +]) + +# SWIG_ENABLE_CXX() +# +# Enable swig C++ support. This effects all invocations of $(SWIG). +AC_DEFUN([SWIG_ENABLE_CXX],[ + AC_REQUIRE([SWIG_PROG]) + AC_REQUIRE([AC_PROG_CXX]) + if test "$SWIG" != "false" ; then + SWIG="$SWIG -c++" + fi +]) + +# SWIG_PYTHON([use-shadow-classes]) +# +# Checks for Python and provides the $(SWIG_PYTHON_CPPFLAGS), +# $(SWIG_PYTHON_LIB) and $(SWIG_PYTHON_OPT) output variables. +# $(SWIG_PYTHON_OPT) contains all necessary swig options to generate +# code for Python. If you need multi module support use +# $(SWIG_PYTHON_LIB) (provided by the SWIG_MULTI_MODULE_SUPPORT() +# macro) to link against the appropriate library. It contains the +# SWIG Python runtime library that is needed by the type check system +# for example. + +AC_DEFUN([SWIG_PYTHON],[ + AC_REQUIRE([SWIG_PROG]) + AC_REQUIRE([PYTHON_DEVEL]) + if test "$SWIG" != "false" ; then + AC_SUBST(SWIG_PYTHON_LIB,[-lswigpy]) +dnl test ! "x$1" = "xno" && swig_shadow=" -shadow" || swig_shadow="" +dnl AC_SUBST(SWIG_PYTHON_OPT,[-python$swig_shadow]) + AC_SUBST(SWIG_PYTHON_OPT,[-python]) + fi + AC_SUBST(SWIG_PYTHON_CPPFLAGS,[$PYTHON_CPPFLAGS]) +]) diff --git a/imbe_vocoder/config/gr_sysv_shm.m4 b/imbe_vocoder/config/gr_sysv_shm.m4 new file mode 100644 index 0000000..5e11e49 --- /dev/null +++ b/imbe_vocoder/config/gr_sysv_shm.m4 @@ -0,0 +1,36 @@ +# Check for IPC System V shm support. -*- Autoconf -*- + +# Copyright 2003 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., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +AC_DEFUN([GR_SYSV_SHM], +[ + AC_LANG_SAVE + AC_LANG_C + + AC_CHECK_HEADERS([sys/ipc.h sys/shm.h]) + + save_LIBS="$LIBS" + AC_SEARCH_LIBS(shmat, [cygipc ipc], + [ IPC_LIBS="$LIBS" ], + [ AC_MSG_WARN([SystemV IPC support not found. ]) ] + ) + LIBS="$save_LIBS" + + AC_LANG_RESTORE + AC_SUBST(IPC_LIBS) +]) diff --git a/imbe_vocoder/config/gr_x86_64.m4 b/imbe_vocoder/config/gr_x86_64.m4 new file mode 100644 index 0000000..3d6f5ea --- /dev/null +++ b/imbe_vocoder/config/gr_x86_64.m4 @@ -0,0 +1,39 @@ +dnl +dnl Copyright 2005 Free Software Foundation, Inc. +dnl +dnl This file is part of GNU Radio +dnl +dnl GNU Radio is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2, or (at your option) +dnl any later version. +dnl +dnl GNU Radio is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with GNU Radio; see the file COPYING. If not, write to +dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +dnl Boston, MA 02111-1307, USA. +dnl + +# GR_X86_64() +# +# Checks to see if we're on a x86_64 machine, and if so, ensure +# that libdir ends in "64" +# +AC_DEFUN([GR_X86_64],[ + AC_REQUIRE([AC_CANONICAL_HOST]) + if test "$host_cpu" = "x86_64"; then + AC_MSG_CHECKING([libdir for lib64 suffix]) + t=${libdir##*/lib} + if test "$t" != 64 && test -d /lib64 && ! test -L /lib64; then + libdir=${libdir}64 + AC_MSG_RESULT([no. Setting libdir to $libdir]) + else + AC_MSG_RESULT([yes]) + fi + fi +]) diff --git a/imbe_vocoder/config/lf_cc.m4 b/imbe_vocoder/config/lf_cc.m4 new file mode 100644 index 0000000..f9bd715 --- /dev/null +++ b/imbe_vocoder/config/lf_cc.m4 @@ -0,0 +1,42 @@ +dnl Autoconf support for C++ +dnl Copyright (C) 1988 Eleftherios Gkioulekas +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +dnl +dnl As a special exception to the GNU General Public License, if you +dnl distribute this file as part of a program that contains a configuration +dnl script generated by Autoconf, you may include it under the same +dnl distribution terms that you use for the rest of that program. + +# ------------------------------------------------------------------------- +# Use this macro to configure your C compiler +# When called the macro does the following things: +# 1. It finds an appropriate C compiler. +# If you passed the flag --with-cc=foo then it uses that +# particular compiler +# 2. Check whether the compiler works. +# 3. Checks whether the compiler accepts the -g +# ------------------------------------------------------------------------- + +AC_DEFUN([LF_CONFIGURE_CC],[ + dnl Sing the song + AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_PROG_CPP])dnl + AC_REQUIRE([AC_AIX])dnl + AC_REQUIRE([AC_ISC_POSIX])dnl + AC_REQUIRE([AC_MINIX])dnl + AC_REQUIRE([AC_HEADER_STDC])dnl +]) + diff --git a/imbe_vocoder/config/lf_cxx.m4 b/imbe_vocoder/config/lf_cxx.m4 new file mode 100644 index 0000000..8ade1fb --- /dev/null +++ b/imbe_vocoder/config/lf_cxx.m4 @@ -0,0 +1,121 @@ +dnl Autoconf support for C++ +dnl Copyright (C) 1988 Eleftherios Gkioulekas +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +dnl +dnl As a special exception to the GNU General Public License, if you +dnl distribute this file as part of a program that contains a configuration +dnl script generated by Autoconf, you may include it under the same +dnl distribution terms that you use for the rest of that program. + +# ----------------------------------------------------------------- +# This macro should be called to configure your C++ compiler. +# When called, the macro does the following things: +# 1. It finds an appropriate C++ compiler +# If you passed the flag --with-cxx=foo, then it uses that +# particular compiler +# 2. Checks whether the compiler accepts the -g +# ------------------------------------------------------------------ + +AC_DEFUN([LF_CONFIGURE_CXX],[ + AC_REQUIRE([AC_PROG_CXX])dnl + AC_REQUIRE([AC_PROG_CXXCPP])dnl + LF_CXX_PORTABILITY +]) + +# ----------------------------------------------------------------------- +# This macro tests the C++ compiler for various portability problem. +# 1. Defines CXX_HAS_NO_BOOL if the compiler does not support the bool +# data type +# 2. Defines CXX_HAS_BUGGY_FOR_LOOPS if the compiler has buggy +# scoping for the for-loop +# 3. Defines USE_ASSERT if the user wants to use assertions +# ----------------------------------------------------------------------- + + +AC_DEFUN([LF_CXX_PORTABILITY],[ + + dnl + dnl Check for common C++ portability problems + dnl + + dnl AC_LANG_PUSH + dnl AC_LANG_CPLUSPLUS + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + + dnl Check whether we have bool + AC_MSG_CHECKING(whether C++ has bool) + AC_TRY_RUN([main() { bool b1=true; bool b2=false; }], + [ AC_MSG_RESULT(yes) ], + [ AC_MSG_RESULT(no) + AC_DEFINE(CXX_HAS_NO_BOOL,[],[Define if C++ is missing bool type]) ], + [ AC_MSG_WARN(Don't cross-compile)] + ) + + dnl Test whether C++ has buggy for-loops + AC_MSG_CHECKING(whether C++ has buggy scoping in for-loops) + AC_TRY_COMPILE([#include ], [ + for (int i=0;i<10;i++) { } + for (int i=0;i<10;i++) { } +], [ AC_MSG_RESULT(no) ], + [ AC_MSG_RESULT(yes) + AC_DEFINE(CXX_HAS_BUGGY_FOR_LOOPS,[],[Define if for loop scoping is broken]) ]) + + dnl Test whether the user wants to enable assertions + AC_MSG_CHECKING(whether user wants assertions) + AC_ARG_ENABLE(assert, + [ --disable-assert don't use cpp.h assert], + [ AC_DEFINE(NDEBUG,[],[Define to disable asserts (don't doit!)]) + AC_MSG_RESULT(no) ], + [ AC_MSG_RESULT(yes) ], + ) + + dnl Test whether C++ has std::isnan + AC_MSG_CHECKING(whether C++ has std::isnan) + AC_TRY_COMPILE([#include ], [ + std::isnan(0); +], [ AC_MSG_RESULT(yes) + AC_DEFINE(CXX_HAS_STD_ISNAN,[],[Define if has std::isnan]) ], + [ AC_MSG_RESULT(no) ]) + + dnl Done with the portability checks + dnl AC_LANG_POP([C++]) + AC_LANG_RESTORE +]) + +AH_BOTTOM([// Workaround for compilers with buggy for-loop scoping +// That's quite a few compilers actually including recent versions of +// Dec Alpha cxx, HP-UX CC and SGI CC. +// The trivial "if" statement provides the correct scoping to the +// for loop + +#ifdef CXX_HAS_BUGGY_FOR_LOOPS +#undef for +#define for if(1) for +#endif +]) + +AH_BOTTOM([// If the C++ compiler we use doesn't have bool, then +// the following is a near-perfect work-around. +// You must make sure your code does not depend on "int" and "bool" +// being two different types, in overloading for instance. + +#ifdef CXX_HAS_NO_BOOL +#define bool int +#define true 1 +#define false 0 +#endif +]) diff --git a/imbe_vocoder/config/lf_warnings.m4 b/imbe_vocoder/config/lf_warnings.m4 new file mode 100644 index 0000000..0ebb97e --- /dev/null +++ b/imbe_vocoder/config/lf_warnings.m4 @@ -0,0 +1,128 @@ +dnl Copyright (C) 1988 Eleftherios Gkioulekas +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +dnl +dnl As a special exception to the GNU General Public License, if you +dnl distribute this file as part of a program that contains a configuration +dnl script generated by Autoconf, you may include it under the same +dnl distribution terms that you use for the rest of that program. + +# -------------------------------------------------------------------------- +# Check whether the C++ compiler accepts a certain flag +# If it does it adds the flag to CXXFLAGS +# If it does not then it returns an error to lf_ok +# Usage: +# LF_CHECK_CXX_FLAG(-flag1 -flag2 -flag3 ...) +# ------------------------------------------------------------------------- + +AC_DEFUN([LF_CHECK_CXX_FLAG],[ + echo 'void f(){}' > conftest.cc + for i in $1 + do + AC_MSG_CHECKING([whether $CXX accepts $i]) + if test -z "`${CXX} $i -c conftest.cc 2>&1`" + then + CXXFLAGS="${CXXFLAGS} $i" + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + done + rm -f conftest.cc conftest.o +]) + +# -------------------------------------------------------------------------- +# Check whether the C compiler accepts a certain flag +# If it does it adds the flag to CFLAGS +# If it does not then it returns an error to lf_ok +# Usage: +# LF_CHECK_CC_FLAG(-flag1 -flag2 -flag3 ...) +# ------------------------------------------------------------------------- + +AC_DEFUN([LF_CHECK_CC_FLAG],[ + echo 'void f(){}' > conftest.c + for i in $1 + do + AC_MSG_CHECKING([whether $CC accepts $i]) + if test -z "`${CC} $i -c conftest.c 2>&1`" + then + CFLAGS="${CFLAGS} $i" + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + done + rm -f conftest.c conftest.o +]) + +# -------------------------------------------------------------------------- +# Check whether the Fortran compiler accepts a certain flag +# If it does it adds the flag to FFLAGS +# If it does not then it returns an error to lf_ok +# Usage: +# LF_CHECK_F77_FLAG(-flag1 -flag2 -flag3 ...) +# ------------------------------------------------------------------------- + +AC_DEFUN([LF_CHECK_F77_FLAG],[ + cat << EOF > conftest.f +c....:++++++++++++++++++++++++ + PROGRAM MAIN + PRINT*,'Hello World!' + END +EOF + for i in $1 + do + AC_MSG_CHECKING([whether $F77 accepts $i]) + if test -z "`${F77} $i -c conftest.f 2>&1`" + then + FFLAGS="${FFLAGS} $i" + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + done + rm -f conftest.f conftest.o +]) + +# ---------------------------------------------------------------------- +# Provide the configure script with an --with-warnings option that +# turns on warnings. Call this command AFTER you have configured ALL your +# compilers. +# ---------------------------------------------------------------------- + +AC_DEFUN([LF_SET_WARNINGS],[ + dnl Check for --with-warnings + AC_MSG_CHECKING([whether user wants warnings]) + AC_ARG_WITH(warnings, + [ --with-warnings Turn on warnings], + [ lf_warnings=yes ], [ lf_warnings=no ]) + lf_warnings=yes # hard code for now -eb + AC_MSG_RESULT($lf_warnings) + + dnl Warnings for the two main compilers + cc_warning_flags="-Wall" + cxx_warning_flags="-Wall -Woverloaded-virtual" + if test $lf_warnings = yes + then + if test -n "${CC}" + then + LF_CHECK_CC_FLAG($cc_warning_flags) + fi + if test -n "${CXX}" + then + LF_CHECK_CXX_FLAG($cxx_warning_flags) + fi + fi +]) diff --git a/imbe_vocoder/config/lf_x11.m4 b/imbe_vocoder/config/lf_x11.m4 new file mode 100644 index 0000000..3bd19f2 --- /dev/null +++ b/imbe_vocoder/config/lf_x11.m4 @@ -0,0 +1,39 @@ +dnl Copyright (C) 1988 Eleftherios Gkioulekas +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +dnl +dnl As a special exception to the GNU General Public License, if you +dnl distribute this file as part of a program that contains a configuration +dnl script generated by Autoconf, you may include it under the same +dnl distribution terms that you use for the rest of that program. + + +#----------------------------------------------------------------------- +# This macro searches for Xlib and when it finds it it adds the +# appropriate flags to CXXFLAGS and export the link sequence to +# the variable XLIB. +# In your configure.in file add: +# LF_PATH_XLIB +# In your Makefile.am add +# program_LDADD = .... $(XLIB) +#------------------------------------------------------------------------ + +AC_DEFUN([LF_PATH_XLIB],[ + AC_PATH_XTRA + CXXFLAGS="$CXXFLAGS $X_CFLAGS" + XLIB="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS" + AC_SUBST(XLIB) +]) + diff --git a/imbe_vocoder/config/mkstemp.m4 b/imbe_vocoder/config/mkstemp.m4 new file mode 100644 index 0000000..4af0f0a --- /dev/null +++ b/imbe_vocoder/config/mkstemp.m4 @@ -0,0 +1,89 @@ +#serial 4 + +# On some hosts (e.g., HP-UX 10.20, SunOS 4.1.4, Solaris 2.5.1), mkstemp has a +# silly limit that it can create no more than 26 files from a given template. +# Other systems lack mkstemp altogether. +# On OSF1/Tru64 V4.0F, the system-provided mkstemp function can create +# only 32 files per process. +# On systems like the above, arrange to use the replacement function. +AC_DEFUN([UTILS_FUNC_MKSTEMP], +[dnl + AC_REPLACE_FUNCS(mkstemp) + if test $ac_cv_func_mkstemp = no; then + utils_cv_func_mkstemp_limitations=yes + else + AC_CACHE_CHECK([for mkstemp limitations], + utils_cv_func_mkstemp_limitations, + [ + AC_TRY_RUN([ +# include + int main () + { + int i; + for (i = 0; i < 70; i++) + { + char template[] = "conftestXXXXXX"; + int fd = mkstemp (template); + if (fd == -1) + exit (1); + close (fd); + } + exit (0); + } + ], + utils_cv_func_mkstemp_limitations=no, + utils_cv_func_mkstemp_limitations=yes, + utils_cv_func_mkstemp_limitations=yes + ) + ] + ) + fi + + if test $utils_cv_func_mkstemp_limitations = yes; then + AC_LIBOBJ(mkstemp) + AC_LIBOBJ(tempname) + AC_DEFINE(mkstemp, rpl_mkstemp, + [Define to rpl_mkstemp if the replacement function should be used.]) + gl_PREREQ_MKSTEMP + jm_PREREQ_TEMPNAME + fi +]) + +# Prerequisites of lib/mkstemp.c. +AC_DEFUN([gl_PREREQ_MKSTEMP], +[ + AH_BOTTOM( + [ + #ifndef HAVE_MKSTEMP + #ifdef __cplusplus + extern "C" { + #endif + int rpl_mkstemp (char *templ); + #ifdef __cplusplus + } + #endif + #endif + ]) +]) + +# Prerequisites of lib/tempname.c. +AC_DEFUN([jm_PREREQ_TEMPNAME], +[ + AC_REQUIRE([AC_HEADER_STAT]) + AC_CHECK_HEADERS_ONCE(fcntl.h sys/time.h unistd.h) + AC_CHECK_HEADERS(stdint.h) + AC_CHECK_FUNCS(__secure_getenv gettimeofday lstat) + AC_CHECK_DECLS_ONCE(getenv) + # AC_REQUIRE([jm_AC_TYPE_UINTMAX_T]) + + dnl Under Win32, mkdir prototype in io.h has only one arg + AC_MSG_CHECKING(whether mkdir accepts only one arg) + AC_TRY_COMPILE([#include + #include + #include ], [ + mkdir("") + ], [ AC_MSG_RESULT(yes) + AC_DEFINE(MKDIR_TAKES_ONE_ARG,[],[Define if mkdir accepts only one arg]) ], + [ AC_MSG_RESULT(no) + ]) +]) diff --git a/imbe_vocoder/config/onceonly.m4 b/imbe_vocoder/config/onceonly.m4 new file mode 100644 index 0000000..f6fec37 --- /dev/null +++ b/imbe_vocoder/config/onceonly.m4 @@ -0,0 +1,63 @@ +# onceonly.m4 serial 3 +dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl This file defines some "once only" variants of standard autoconf macros. +dnl AC_CHECK_HEADERS_ONCE like AC_CHECK_HEADERS +dnl AC_CHECK_FUNCS_ONCE like AC_CHECK_FUNCS +dnl AC_CHECK_DECLS_ONCE like AC_CHECK_DECLS +dnl AC_REQUIRE([AC_HEADER_STDC]) like AC_HEADER_STDC +dnl The advantage is that the check for each of the headers/functions/decls +dnl will be put only once into the 'configure' file. It keeps the size of +dnl the 'configure' file down, and avoids redundant output when 'configure' +dnl is run. +dnl The drawback is that the checks cannot be conditionalized. If you write +dnl if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi +dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to +dnl empty, and the check will be inserted before the body of the AC_DEFUNed +dnl function. + +dnl Autoconf version 2.57 or newer is recommended. +AC_PREREQ(2.54) + +# AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of +# AC_CHECK_HEADERS(HEADER1 HEADER2 ...). +AC_DEFUN([AC_CHECK_HEADERS_ONCE], [ + : + AC_FOREACH([gl_HEADER_NAME], [$1], [ + AC_DEFUN([gl_CHECK_HEADER_]m4_quote(translit(defn([gl_HEADER_NAME]), + [-./], [___])), [ + AC_CHECK_HEADERS(gl_HEADER_NAME) + ]) + AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME, + [-./], [___]))) + ]) +]) + +# AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of +# AC_CHECK_FUNCS(FUNC1 FUNC2 ...). +AC_DEFUN([AC_CHECK_FUNCS_ONCE], [ + : + AC_FOREACH([gl_FUNC_NAME], [$1], [ + AC_DEFUN([gl_CHECK_FUNC_]defn([gl_FUNC_NAME]), [ + AC_CHECK_FUNCS(defn([gl_FUNC_NAME])) + ]) + AC_REQUIRE([gl_CHECK_FUNC_]defn([gl_FUNC_NAME])) + ]) +]) + +# AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of +# AC_CHECK_DECLS(DECL1, DECL2, ...). +AC_DEFUN([AC_CHECK_DECLS_ONCE], [ + : + AC_FOREACH([gl_DECL_NAME], [$1], [ + AC_DEFUN([gl_CHECK_DECL_]defn([gl_DECL_NAME]), [ + AC_CHECK_DECLS(defn([gl_DECL_NAME])) + ]) + AC_REQUIRE([gl_CHECK_DECL_]defn([gl_DECL_NAME])) + ]) +]) diff --git a/imbe_vocoder/config/pkg.m4 b/imbe_vocoder/config/pkg.m4 new file mode 100644 index 0000000..770f062 --- /dev/null +++ b/imbe_vocoder/config/pkg.m4 @@ -0,0 +1,68 @@ +dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) +dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page +dnl also defines GSTUFF_PKG_ERRORS on error +AC_DEFUN([PKG_CHECK_MODULES], [ + succeeded=no + + if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + dnl If PKG_CONFIG_PATH is not already set, add /usr/local/lib/pkgconfig. + dnl If it's set, assume the user knows what they're doing. + dnl This should help avoid failures while looking for fftw3f + if test -z "$PKG_CONFIG_PATH"; then + export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" + fi + + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + AC_MSG_CHECKING(for $2) + + if $PKG_CONFIG --exists "$2" ; then + AC_MSG_RESULT(yes) + succeeded=yes + + AC_MSG_CHECKING($1_CFLAGS) + $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` + AC_MSG_RESULT($$1_CFLAGS) + + AC_MSG_CHECKING($1_LIBS) + $1_LIBS=`$PKG_CONFIG --libs "$2"` + AC_MSG_RESULT($$1_LIBS) + + AC_MSG_CHECKING($1_INCLUDEDIR) + $1_INCLUDEDIR=`$PKG_CONFIG --variable=includedir "$2"` + AC_MSG_RESULT($$1_INCLUDEDIR) + else + $1_CFLAGS="" + $1_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + ifelse([$4], ,echo $$1_PKG_ERRORS,) + fi + + AC_SUBST($1_CFLAGS) + AC_SUBST($1_LIBS) + AC_SUBST($1_INCLUDEDIR) + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + ifelse([$3], , :, [$3]) + else + ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) + fi +]) + + diff --git a/imbe_vocoder/config/usrp_fusb_tech.m4 b/imbe_vocoder/config/usrp_fusb_tech.m4 new file mode 100644 index 0000000..8ebbd7c --- /dev/null +++ b/imbe_vocoder/config/usrp_fusb_tech.m4 @@ -0,0 +1,56 @@ +dnl +dnl Copyright 2003 Free Software Foundation, Inc. +dnl +dnl This file is part of GNU Radio +dnl +dnl GNU Radio is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2, or (at your option) +dnl any later version. +dnl +dnl GNU Radio is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with GNU Radio; see the file COPYING. If not, write to +dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +dnl Boston, MA 02111-1307, USA. +dnl + +AC_DEFUN([USRP_SET_FUSB_TECHNIQUE],[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_ARG_WITH(fusb-tech, + [ --with-fusb-tech=OS set fast usb technique (auto)], + [cf_with_fusb_tech="$withval"], + [cf_with_fusb_tech="$host_os"]) + + + AC_CHECK_HEADER([linux/usbdevice_fs.h], + [x_have_usbdevice_fs_h=yes], + [x_have_usbdevice_fs_h=no]) + + AC_MSG_CHECKING([for fast usb technique to use]) + case "$cf_with_fusb_tech" in + linux*) if test x${x_have_usbdevice_fs_h} = xyes; + then + FUSB_TECH=linux + else + FUSB_TECH=generic + fi ;; + + darwin*) FUSB_TECH=darwin ;; + cygwin*|win*|mingw*) FUSB_TECH=win32 ;; + *) FUSB_TECH=generic ;; + esac + + AC_MSG_RESULT($FUSB_TECH) + AC_SUBST(FUSB_TECH) + + AM_CONDITIONAL(FUSB_TECH_darwin, test $FUSB_TECH = darwin) + AM_CONDITIONAL(FUSB_TECH_win32, test $FUSB_TECH = win32) + AM_CONDITIONAL(FUSB_TECH_generic, test $FUSB_TECH = generic) + AM_CONDITIONAL(FUSB_TECH_linux, test $FUSB_TECH = linux) +]) + diff --git a/imbe_vocoder/config/usrp_libusb.m4 b/imbe_vocoder/config/usrp_libusb.m4 new file mode 100644 index 0000000..b1a554e --- /dev/null +++ b/imbe_vocoder/config/usrp_libusb.m4 @@ -0,0 +1,43 @@ +# Check for libusb support. -*- Autoconf -*- + +# Copyright 2003 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., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +AC_DEFUN([USRP_LIBUSB], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_LANG_PUSH(C) + + AC_CHECK_HEADERS([usb.h], + [], + [ AC_MSG_ERROR([USRP requires libusb. usb.h not found, stop. See http://libusb.sf.net]) ] + ) + + save_LIBS="$LIBS" + case "$host_os" in + darwin*) LIBS="$LIBS -lIOKit" ;; + *) ;; + esac + AC_SEARCH_LIBS(usb_bulk_write, [usb], + [ USB_LIBS="$LIBS" ], + [ AC_MSG_ERROR([USRP requires libusb. usb_bulk_write not found, stop. See http://libusb.sf.net]) ] + ) + LIBS="$save_LIBS" + + AC_LANG_POP + AC_SUBST(USB_LIBS) +]) diff --git a/imbe_vocoder/config/usrp_sdcc.m4 b/imbe_vocoder/config/usrp_sdcc.m4 new file mode 100644 index 0000000..81c255a --- /dev/null +++ b/imbe_vocoder/config/usrp_sdcc.m4 @@ -0,0 +1,67 @@ +# Check for sdcc support. -*- Autoconf -*- + +# Copyright 2004 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., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +AC_DEFUN([USRP_SDCC], +[ + AC_CHECK_PROG(XCC, sdcc, sdcc -mmcs51 --no-xinit-opt,no) + AC_CHECK_PROG(XAS, asx8051, asx8051 -plosgff,no) + + if test "$XCC" = "no" -o "$XAS" = "no" ; then + AC_MSG_ERROR([USRP requires sdcc. sdcc not found, stop. See http://sdcc.sf.net]) + fi + + sdcc_version_min=$1 + + sdcc_version=`sdcc --version 2>&1 | \ + sed 's/\(SDCC.* \)\([[0-9]]*\.[[0-9]]*\.[[0-9]]*\)\( .*$\)/\2/'` + + AC_MSG_CHECKING([sdcc_version "$sdcc_version"]) + + sdcc_major_version=`echo $sdcc_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + sdcc_minor_version=`echo $sdcc_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + sdcc_micro_version=`echo $sdcc_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + + sdcc_major_min=`echo $sdcc_version_min | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + sdcc_minor_min=`echo $sdcc_version_min | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + sdcc_micro_min=`echo $sdcc_version_min | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + + sdcc_version_proper=`expr \ + "$sdcc_major_version" \> "$sdcc_major_min" \| \ + "$sdcc_major_version" \= "$sdcc_major_min" \& \ + "$sdcc_minor_version" \> "$sdcc_minor_min" \| \ + "$sdcc_major_version" \= "$sdcc_major_min" \& \ + "$sdcc_minor_version" \= "$sdcc_minor_min" \& \ + "$sdcc_micro_version" \>= "$sdcc_micro_min" ` + + if test "$sdcc_version_proper" = "1" ; then + AC_MSG_RESULT([$sdcc_major_version.$sdcc_minor_version.$sdcc_micro_version]) + else + AC_MSG_ERROR([USRP requires sdcc >= $sdcc_version_min. sdcc not found, stop. See http://sdcc.sf.net]) + fi + + AC_SUBST(XCC) + AC_SUBST(XAS) + +]) diff --git a/imbe_vocoder/configure.ac b/imbe_vocoder/configure.ac new file mode 100644 index 0000000..665e233 --- /dev/null +++ b/imbe_vocoder/configure.ac @@ -0,0 +1,103 @@ +dnl +dnl Copyright 2004,2005 Free Software Foundation, Inc. +dnl +dnl This file is part of GNU Radio +dnl +dnl GNU Radio is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2, or (at your option) +dnl any later version. +dnl +dnl GNU Radio is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with GNU Radio; see the file COPYING. If not, write to +dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +dnl Boston, MA 02111-1307, USA. +dnl + +AC_INIT +AC_PREREQ(2.57) +AC_CONFIG_SRCDIR([src/lib/op25_imbe.i]) +AM_CONFIG_HEADER(config.h) +AC_CANONICAL_TARGET([]) +AM_INIT_AUTOMAKE(gr-op25_imbe,0.1) + +GR_X86_64 +dnl LF_CONFIGURE_CC +LF_CONFIGURE_CXX +LF_SET_WARNINGS +GR_SET_GPROF +GR_SET_PROF +GR_PROG_AS +AC_PROG_LN_S +AC_PROG_MAKE_SET +AC_PROG_INSTALL + +AC_LIBTOOL_WIN32_DLL +AC_ENABLE_SHARED dnl do build shared libraries +AC_DISABLE_STATIC dnl don't build static libraries +AC_PROG_LIBTOOL + +dnl Locate python, SWIG, etc +GR_NO_UNDEFINED +GR_SCRIPTING + +dnl Checks for libraries. + +dnl check for threads (mandatory) +GR_OMNITHREAD + +CFLAGS="${CFLAGS} $PTHREAD_CFLAGS" +CXXFLAGS="${CXXFLAGS} $PTHREAD_CFLAGS" + +if test "x$CXX_FOR_BUILD" = x +then + CXX_FOR_BUILD=${CXX} +fi +AC_SUBST(CXX_FOR_BUILD) + +dnl Checks for header files. +AC_HEADER_STDC +AC_HEADER_SYS_WAIT +AC_CHECK_HEADERS(fcntl.h limits.h strings.h sys/ioctl.h sys/time.h unistd.h) +AC_CHECK_HEADERS(sys/mman.h) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_C_INLINE +AC_TYPE_SIZE_T +AC_HEADER_TIME + +dnl Checks for library functions. +AC_CHECK_FUNCS([]) + +dnl Check for Mingw support +GR_PWIN32 + +PKG_CHECK_MODULES(GNURADIO_CORE, gnuradio-core >= 2) +LIBS="$LIBS $GNURADIO_CORE_LIBS" + +dnl Define where to find boost includes +dnl defines BOOST_CFLAGS +GR_REQUIRE_BOOST_INCLUDES + +STD_DEFINES_AND_INCLUDES="$GNURADIO_CORE_CFLAGS $BOOST_CFLAGS" +AC_SUBST(STD_DEFINES_AND_INCLUDES) + +AC_CONFIG_FILES([\ + Makefile \ + config/Makefile \ + src/Makefile \ + src/lib/Makefile \ + src/python/Makefile \ + src/python/run_tests \ + ]) + +dnl run_tests is created from run_tests.in. Make it executable. +AC_CONFIG_COMMANDS([run_tests], [chmod +x src/python/run_tests]) + +AC_OUTPUT diff --git a/imbe_vocoder/src/Makefile.am b/imbe_vocoder/src/Makefile.am new file mode 100644 index 0000000..122fc72 --- /dev/null +++ b/imbe_vocoder/src/Makefile.am @@ -0,0 +1,22 @@ +# +# Copyright 2004 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# + +SUBDIRS = lib python diff --git a/imbe_vocoder/src/lib/Makefile.am b/imbe_vocoder/src/lib/Makefile.am new file mode 100644 index 0000000..ccbba7a --- /dev/null +++ b/imbe_vocoder/src/lib/Makefile.am @@ -0,0 +1,113 @@ +# +# Copyright 2004,2005,2006 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# + +include $(top_srcdir)/Makefile.common + +# Install this stuff so that it ends up as the gnuradio.op25_imbe module +# This usually ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio + +ourpythondir = $(grpythondir) +ourlibdir = $(grpyexecdir) + +INCLUDES = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) + +SWIGPYTHONARGS = $(SWIGPYTHONFLAGS) $(SWIGGRFLAGS) + +ALL_IFILES = \ + $(LOCAL_IFILES) \ + $(NON_LOCAL_IFILES) + +NON_LOCAL_IFILES = \ + $(GNURADIO_CORE_INCLUDEDIR)/swig/gnuradio.i + + +LOCAL_IFILES = \ + op25_imbe.i + +# These files are built by SWIG. The first is the C++ glue. +# The second is the python wrapper that loads the _op25_imbe shared library +# and knows how to call our extensions. + +BUILT_SOURCES = \ + op25_imbe.cc \ + op25_imbe.py + +# This gets op25_imbe.py installed in the right place +ourpython_PYTHON = \ + op25_imbe.py + +ourlib_LTLIBRARIES = _op25_imbe.la + +# These are the source files that go into the shared library +_op25_imbe_la_SOURCES = \ + op25_imbe.cc \ + aux_sub.cc \ + basicop2.cc \ + ch_decode.cc \ + ch_encode.cc \ + dc_rmv.cc \ + decode.cc \ + dsp_sub.cc \ + encode.cc \ + math_sub.cc \ + op25_imbe_vocoder.cc \ + pe_lpf.cc \ + pitch_est.cc \ + pitch_ref.cc \ + qnt_sub.cc \ + rand_gen.cc \ + sa_decode.cc \ + sa_encode.cc \ + sa_enh.cc \ + tbls.cc \ + uv_synt.cc \ + v_synt.cc \ + v_uv_det.cc + +# magic flags +_op25_imbe_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version + +# link the library against some comon swig runtime code and the +# c++ standard library +_op25_imbe_la_LIBADD = \ + $(PYTHON_LDFLAGS) \ + -lstdc++ + +op25_imbe.cc op25_imbe.py: op25_imbe.i $(ALL_IFILES) + $(SWIG) $(SWIGPYTHONARGS) -module op25_imbe -o op25_imbe.cc $< + +# These headers get installed in ${prefix}/include/gnuradio +grinclude_HEADERS = \ + op25_imbe_vocoder.h + + +# These swig headers get installed in ${prefix}/include/gnuradio/swig +swiginclude_HEADERS = \ + $(LOCAL_IFILES) + + +MOSTLYCLEANFILES = $(BUILT_SOURCES) *.pyc + +# Don't distribute output of swig +dist-hook: + @for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done + @for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done diff --git a/imbe_vocoder/src/lib/aux_sub.cc b/imbe_vocoder/src/lib/aux_sub.cc new file mode 100644 index 0000000..1bfa300 --- /dev/null +++ b/imbe_vocoder/src/lib/aux_sub.cc @@ -0,0 +1,182 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ +#include "typedef.h" +#include "basic_op.h" +#include "imbe.h" +#include "aux_sub.h" +#include "tbls.h" + +//----------------------------------------------------------------------------- +// PURPOSE: +// Return pointer to bit allocation array +// according to the number of harmonics +// +// INPUT: +// num_harms - The number of harmonics +// +// OUTPUT: +// None +// +// RETURN: +// Pointer to bits allocation array +// +//----------------------------------------------------------------------------- +const Word16 *get_bit_allocation_arr(Word16 num_harms) +{ + Word16 offset_in_word, index; + + if(num_harms == NUM_HARMS_MIN) + return &bit_allocation_tbl[0]; + else + { + index = num_harms - NUM_HARMS_MIN - 1; + offset_in_word = bit_allocation_offset_tbl[index >> 2] + ((3 + (index >> 2)) * (index & 0x3)); + return &bit_allocation_tbl[offset_in_word]; + } +} + +//----------------------------------------------------------------------------- +// PURPOSE: +// Unpack bit allocation table's item +// +// INPUT: +// num_harms - The number of harmonics +// ptr - Pointer to buffer to place bit allocation data +// +// OUTPUT: +// Unpacked bit allocation table +// +// RETURN: +// None +// +//----------------------------------------------------------------------------- +void get_bit_allocation(Word16 num_harms, Word16 *ptr) +{ + const Word16 *bat_ptr; + Word16 i, tmp; + + bat_ptr = get_bit_allocation_arr(num_harms); + + for(i = 0; i < num_harms - 1; i += 4) + { + tmp = *bat_ptr++; + ptr[3] = tmp & 0xF; tmp >>= 4; + ptr[2] = tmp & 0xF; tmp >>= 4; + ptr[1] = tmp & 0xF; tmp >>= 4; + ptr[0] = tmp & 0xF; + ptr += 4; + } +} + +//----------------------------------------------------------------------------- +// PURPOSE: +// Set the elements of a 16 bit input vector to zero. +// +// INPUT: +// vec - Pointer to vector +// n - size of vec +// +// OUTPUT: +// None +// +// RETURN: +// None +// +//----------------------------------------------------------------------------- +void v_zap(Word16 *vec, Word16 n) +{ + while(n--) + *vec++ = 0; +} + +//----------------------------------------------------------------------------- +// PURPOSE: +// Copy the contents of one 16 bit input vector to another +// +// INPUT: +// vec1 - Pointer to the destination vector +// vec2 - Pointer to the source vector +// n - size of data should be copied +// +// OUTPUT: +// Copy of the source vector +// +// RETURN: +// None +// +//----------------------------------------------------------------------------- +void v_equ(Word16 *vec1, Word16 *vec2, Word16 n) +{ + while(n--) + *vec1++ = *vec2++; +} + +//----------------------------------------------------------------------------- +// PURPOSE: +// Compute the sum of square magnitude of a 16 bit input vector +// with saturation and truncation. Output is a 32 bit number. +// +// INPUT: +// vec - Pointer to the vector +// n - size of input vectors +// +// OUTPUT: +// none +// +// RETURN: +// 32 bit long signed integer result +// +//----------------------------------------------------------------------------- +Word32 L_v_magsq(Word16 *vec, Word16 n) +{ + Word32 L_magsq = 0; + + while(n--) + { + L_magsq = L_mac(L_magsq, *vec, *vec); + vec++; + } + return L_magsq; +} + +//----------------------------------------------------------------------------- +// PURPOSE: +// Copy the contents of one 16 bit input vector to another with shift +// +// INPUT: +// vec1 - Pointer to the destination vector +// vec2 - Pointer to the source vector +// scale - right shift factor +// n - size of data should be copied +// +// OUTPUT: +// Copy of the source vector +// +// RETURN: +// None +// +//----------------------------------------------------------------------------- +void v_equ_shr(Word16 *vec1, Word16 *vec2, Word16 scale, Word16 n) +{ + while(n--) + *vec1++ = shr(*vec2++,scale); +} + diff --git a/imbe_vocoder/src/lib/aux_sub.h b/imbe_vocoder/src/lib/aux_sub.h new file mode 100644 index 0000000..dca74ee --- /dev/null +++ b/imbe_vocoder/src/lib/aux_sub.h @@ -0,0 +1,133 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + + +#ifndef _AUX_SUB +#define _AUX_SUB + + +//----------------------------------------------------------------------------- +// PURPOSE: +// Return pointer to bit allocation array +// according to the number of harmonics +// +// INPUT: +// num_harms - The number of harmonics +// +// OUTPUT: +// None +// +// RETURN: +// Pointer to bits allocation array +// +//----------------------------------------------------------------------------- +const Word16 *get_bit_allocation_arr(Word16 num_harms); + +//----------------------------------------------------------------------------- +// PURPOSE: +// Unpack bit allocation table's item +// +// INPUT: +// num_harms - The number of harmonics +// ptr - Pointer to buffer to place bit allocation data +// +// OUTPUT: +// Unpacked bit allocation table +// +// RETURN: +// None +// +//----------------------------------------------------------------------------- +void get_bit_allocation(Word16 num_harms, Word16 *ptr); + +//----------------------------------------------------------------------------- +// PURPOSE: +// Set the elements of a 16 bit input vector to zero. +// +// INPUT: +// vec - Pointer to vector +// n - size of vec +// +// OUTPUT: +// None +// +// RETURN: +// None +// +//----------------------------------------------------------------------------- +void v_zap(Word16 *vec, Word16 n); + +//----------------------------------------------------------------------------- +// PURPOSE: +// Copy the contents of one 16 bit input vector to another +// +// INPUT: +// vec1 - Pointer to the destination vector +// vec2 - Pointer to the source vector +// n - size of data should be copied +// +// OUTPUT: +// Copy of the source vector +// +// RETURN: +// None +// +//----------------------------------------------------------------------------- +void v_equ(Word16 *vec1, Word16 *vec2, Word16 n); + +//----------------------------------------------------------------------------- +// PURPOSE: +// Compute the sum of square magnitude of a 16 bit input vector +// with saturation and truncation. Output is a 32 bit number. +// +// INPUT: +// vec - Pointer to the vector +// n - size of input vectors +// +// OUTPUT: +// none +// +// RETURN: +// 32 bit long signed integer result +// +//----------------------------------------------------------------------------- +Word32 L_v_magsq(Word16 *vec, Word16 n); + +//----------------------------------------------------------------------------- +// PURPOSE: +// Copy the contents of one 16 bit input vector to another with shift +// +// INPUT: +// vec1 - Pointer to the destination vector +// vec2 - Pointer to the source vector +// scale - right shift factor +// n - size of data should be copied +// +// OUTPUT: +// Copy of the source vector +// +// RETURN: +// None +// +//----------------------------------------------------------------------------- +void v_equ_shr(Word16 *vec1, Word16 *vec2, Word16 scale, Word16 n); + +#endif diff --git a/imbe_vocoder/src/lib/basic_op.h b/imbe_vocoder/src/lib/basic_op.h new file mode 100644 index 0000000..9132ba1 --- /dev/null +++ b/imbe_vocoder/src/lib/basic_op.h @@ -0,0 +1,85 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ +/*___________________________________________________________________________ + | | + | Constants and Globals | + | | + | $Id $ + |___________________________________________________________________________| +*/ +extern Flag Overflow; +extern Flag Carry; + +#define MAX_32 (Word32)0x7fffffffL +#define MIN_32 (Word32)0x80000000L + +#define MAX_16 (Word16)0x7fff +#define MIN_16 (Word16)0x8000 + +/*___________________________________________________________________________ + | | + | Prototypes for basic arithmetic operators | + |___________________________________________________________________________| +*/ + +Word16 add (Word16 var1, Word16 var2); /* Short add, 1 */ +Word16 sub (Word16 var1, Word16 var2); /* Short sub, 1 */ +Word16 abs_s (Word16 var1); /* Short abs, 1 */ +Word16 shl (Word16 var1, Word16 var2); /* Short shift left, 1 */ +Word16 shr (Word16 var1, Word16 var2); /* Short shift right, 1 */ +Word16 mult (Word16 var1, Word16 var2); /* Short mult, 1 */ +Word32 L_mult (Word16 var1, Word16 var2); /* Long mult, 1 */ +Word16 negate (Word16 var1); /* Short negate, 1 */ +Word16 extract_h (Word32 L_var1); /* Extract high, 1 */ +Word16 extract_l (Word32 L_var1); /* Extract low, 1 */ +Word16 round (Word32 L_var1); /* Round, 1 */ +Word32 L_mac (Word32 L_var3, Word16 var1, Word16 var2); /* Mac, 1 */ +Word32 L_msu (Word32 L_var3, Word16 var1, Word16 var2); /* Msu, 1 */ +Word32 L_macNs (Word32 L_var3, Word16 var1, Word16 var2); /* Mac without + sat, 1 */ +Word32 L_msuNs (Word32 L_var3, Word16 var1, Word16 var2); /* Msu without + sat, 1 */ +Word32 L_add (Word32 L_var1, Word32 L_var2); /* Long add, 2 */ +Word32 L_sub (Word32 L_var1, Word32 L_var2); /* Long sub, 2 */ +Word32 L_add_c (Word32 L_var1, Word32 L_var2); /* Long add with c, 2 */ +Word32 L_sub_c (Word32 L_var1, Word32 L_var2); /* Long sub with c, 2 */ +Word32 L_negate (Word32 L_var1); /* Long negate, 2 */ +Word16 mult_r (Word16 var1, Word16 var2); /* Mult with round, 2 */ +Word32 L_shl (Word32 L_var1, Word16 var2); /* Long shift left, 2 */ +Word32 L_shr (Word32 L_var1, Word16 var2); /* Long shift right, 2*/ +Word16 shr_r (Word16 var1, Word16 var2); /* Shift right with + round, 2 */ +Word16 mac_r (Word32 L_var3, Word16 var1, Word16 var2); /* Mac with + rounding,2 */ +Word16 msu_r (Word32 L_var3, Word16 var1, Word16 var2); /* Msu with + rounding,2 */ +Word32 L_deposit_h (Word16 var1); /* 16 bit var1 -> MSB, 2 */ +Word32 L_deposit_l (Word16 var1); /* 16 bit var1 -> LSB, 2 */ + +Word32 L_shr_r (Word32 L_var1, Word16 var2); /* Long shift right with + round, 3 */ +Word32 L_abs (Word32 L_var1); /* Long abs, 3 */ +Word32 L_sat (Word32 L_var1); /* Long saturation, 4 */ +Word16 norm_s (Word16 var1); /* Short norm, 15 */ +Word16 div_s (Word16 var1, Word16 var2); /* Short division, 18 */ +Word16 norm_l (Word32 L_var1); /* Long norm, 30 */ + + diff --git a/imbe_vocoder/src/lib/basicop2.cc b/imbe_vocoder/src/lib/basicop2.cc new file mode 100644 index 0000000..66f44a3 --- /dev/null +++ b/imbe_vocoder/src/lib/basicop2.cc @@ -0,0 +1,2157 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ +/*___________________________________________________________________________ + | | + | Basic arithmetic operators. | + | | + | $Id $ + |___________________________________________________________________________| +*/ + +/*___________________________________________________________________________ + | | + | Include-Files | + |___________________________________________________________________________| +*/ + +#include +#include +#include "typedef.h" +#include "basic_op.h" + +#if (WMOPS) +#include "count.h" +extern BASIC_OP multiCounter[MAXCOUNTERS]; +extern int currCounter; + +#endif + +/*___________________________________________________________________________ + | | + | Local Functions | + |___________________________________________________________________________| +*/ +Word16 saturate (Word32 L_var1); + +/*___________________________________________________________________________ + | | + | Constants and Globals | + |___________________________________________________________________________| +*/ +Flag Overflow = 0; +Flag Carry = 0; + +/*___________________________________________________________________________ + | | + | Functions | + |___________________________________________________________________________| +*/ + +/*___________________________________________________________________________ + | | + | Function Name : saturate | + | | + | Purpose : | + | | + | Limit the 32 bit input to the range of a 16 bit word. | + | | + | Inputs : | + | | + | L_var1 | + | 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var1 <= 0x7fff ffff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | var_out | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | + |___________________________________________________________________________| +*/ + +Word16 +saturate (Word32 L_var1) +{ + Word16 var_out; + + if (L_var1 > 0X00007fffL) + { + Overflow = 1; + var_out = MAX_16; + } + else if (L_var1 < (Word32) 0xffff8000L) + { + Overflow = 1; + var_out = MIN_16; + } + else + { + var_out = extract_l (L_var1); +#if (WMOPS) + multiCounter[currCounter].extract_l--; +#endif + } + + return (var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : add | + | | + | Purpose : | + | | + | Performs the addition (var1+var2) with overflow control and saturation;| + | the 16 bit result is set at +32767 when overflow occurs or at -32768 | + | when underflow occurs. | + | | + | Complexity weight : 1 | + | | + | Inputs : | + | | + | var1 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | var2 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | var_out | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | + |___________________________________________________________________________| +*/ + +Word16 add (Word16 var1, Word16 var2) +{ + Word16 var_out; + Word32 L_sum; + + L_sum = (Word32) var1 + var2; + var_out = saturate (L_sum); +#if (WMOPS) + multiCounter[currCounter].add++; +#endif + return (var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : sub | + | | + | Purpose : | + | | + | Performs the subtraction (var1+var2) with overflow control and satu- | + | ration; the 16 bit result is set at +32767 when overflow occurs or at | + | -32768 when underflow occurs. | + | | + | Complexity weight : 1 | + | | + | Inputs : | + | | + | var1 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | var2 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | var_out | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | + |___________________________________________________________________________| +*/ + +Word16 sub (Word16 var1, Word16 var2) +{ + Word16 var_out; + Word32 L_diff; + + L_diff = (Word32) var1 - var2; + var_out = saturate (L_diff); +#if (WMOPS) + multiCounter[currCounter].sub++; +#endif + return (var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : abs_s | + | | + | Purpose : | + | | + | Absolute value of var1; abs_s(-32768) = 32767. | + | | + | Complexity weight : 1 | + | | + | Inputs : | + | | + | var1 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | var_out | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0x0000 0000 <= var_out <= 0x0000 7fff. | + |___________________________________________________________________________| +*/ + +Word16 abs_s (Word16 var1) +{ + Word16 var_out; + + if (var1 == (Word16) 0X8000) + { + var_out = MAX_16; + } + else + { + if (var1 < 0) + { + var_out = -var1; + } + else + { + var_out = var1; + } + } +#if (WMOPS) + multiCounter[currCounter].abs_s++; +#endif + return (var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : shl | + | | + | Purpose : | + | | + | Arithmetically shift the 16 bit input var1 left var2 positions.Zero fill| + | the var2 LSB of the result. If var2 is negative, arithmetically shift | + | var1 right by -var2 with sign extension. Saturate the result in case of | + | underflows or overflows. | + | | + | Complexity weight : 1 | + | | + | Inputs : | + | | + | var1 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | var2 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | var_out | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | + |___________________________________________________________________________| +*/ + +Word16 shl (Word16 var1, Word16 var2) +{ + Word16 var_out; + Word32 result; + + if (var2 < 0) + { + if (var2 < -16) + var2 = -16; + var_out = shr (var1, -var2); +#if (WMOPS) + multiCounter[currCounter].shr--; +#endif + } + else + { + result = (Word32) var1 *((Word32) 1 << var2); + + if ((var2 > 15 && var1 != 0) || (result != (Word32) ((Word16) result))) + { + Overflow = 1; + var_out = (var1 > 0) ? MAX_16 : MIN_16; + } + else + { + var_out = extract_l (result); +#if (WMOPS) + multiCounter[currCounter].extract_l--; +#endif + } + } +#if (WMOPS) + multiCounter[currCounter].shl++; +#endif + return (var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : shr | + | | + | Purpose : | + | | + | Arithmetically shift the 16 bit input var1 right var2 positions with | + | sign extension. If var2 is negative, arithmetically shift var1 left by | + | -var2 with sign extension. Saturate the result in case of underflows or | + | overflows. | + | | + | Complexity weight : 1 | + | | + | Inputs : | + | | + | var1 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | var2 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | var_out | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | + |___________________________________________________________________________| +*/ + +Word16 shr (Word16 var1, Word16 var2) +{ + Word16 var_out; + + if (var2 < 0) + { + if (var2 < -16) + var2 = -16; + var_out = shl (var1, -var2); +#if (WMOPS) + multiCounter[currCounter].shl--; +#endif + } + else + { + if (var2 >= 15) + { + var_out = (var1 < 0) ? -1 : 0; + } + else + { + if (var1 < 0) + { + var_out = ~((~var1) >> var2); + } + else + { + var_out = var1 >> var2; + } + } + } + +#if (WMOPS) + multiCounter[currCounter].shr++; +#endif + return (var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : mult | + | | + | Purpose : | + | | + | Performs the multiplication of var1 by var2 and gives a 16 bit result | + | which is scaled i.e.: | + | mult(var1,var2) = extract_l(L_shr((var1 times var2),15)) and | + | mult(-32768,-32768) = 32767. | + | | + | Complexity weight : 1 | + | | + | Inputs : | + | | + | var1 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | var2 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | var_out | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | + |___________________________________________________________________________| +*/ + +Word16 mult (Word16 var1, Word16 var2) +{ + Word16 var_out; + Word32 L_product; + + L_product = (Word32) var1 *(Word32) var2; + + L_product = (L_product & (Word32) 0xffff8000L) >> 15; + + if (L_product & (Word32) 0x00010000L) + L_product = L_product | (Word32) 0xffff0000L; + + var_out = saturate (L_product); +#if (WMOPS) + multiCounter[currCounter].mult++; +#endif + return (var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : L_mult | + | | + | Purpose : | + | | + | L_mult is the 32 bit result of the multiplication of var1 times var2 | + | with one shift left i.e.: | + | L_mult(var1,var2) = L_shl((var1 times var2),1) and | + | L_mult(-32768,-32768) = 2147483647. | + | | + | Complexity weight : 1 | + | | + | Inputs : | + | | + | var1 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | var2 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | L_var_out | + | 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | + |___________________________________________________________________________| +*/ + +Word32 L_mult (Word16 var1, Word16 var2) +{ + Word32 L_var_out; + + L_var_out = (Word32) var1 *(Word32) var2; + + if (L_var_out != (Word32) 0x40000000L) + { + L_var_out *= 2; + } + else + { + Overflow = 1; + L_var_out = MAX_32; + } + +#if (WMOPS) + multiCounter[currCounter].L_mult++; +#endif + return (L_var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : negate | + | | + | Purpose : | + | | + | Negate var1 with saturation, saturate in the case where input is -32768:| + | negate(var1) = sub(0,var1). | + | | + | Complexity weight : 1 | + | | + | Inputs : | + | | + | var1 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | var_out | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | + |___________________________________________________________________________| +*/ + +Word16 negate (Word16 var1) +{ + Word16 var_out; + + var_out = (var1 == MIN_16) ? MAX_16 : -var1; +#if (WMOPS) + multiCounter[currCounter].negate++; +#endif + return (var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : extract_h | + | | + | Purpose : | + | | + | Return the 16 MSB of L_var1. | + | | + | Complexity weight : 1 | + | | + | Inputs : | + | | + | L_var1 | + | 32 bit long signed integer (Word32 ) whose value falls in the | + | range : 0x8000 0000 <= L_var1 <= 0x7fff ffff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | var_out | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | + |___________________________________________________________________________| +*/ + +Word16 extract_h (Word32 L_var1) +{ + Word16 var_out; + + var_out = (Word16) (L_var1 >> 16); +#if (WMOPS) + multiCounter[currCounter].extract_h++; +#endif + return (var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : extract_l | + | | + | Purpose : | + | | + | Return the 16 LSB of L_var1. | + | | + | Complexity weight : 1 | + | | + | Inputs : | + | | + | L_var1 | + | 32 bit long signed integer (Word32 ) whose value falls in the | + | range : 0x8000 0000 <= L_var1 <= 0x7fff ffff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | var_out | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | + |___________________________________________________________________________| +*/ + +Word16 extract_l (Word32 L_var1) +{ + Word16 var_out; + + var_out = (Word16) L_var1; +#if (WMOPS) + multiCounter[currCounter].extract_l++; +#endif + return (var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : round | + | | + | Purpose : | + | | + | Round the lower 16 bits of the 32 bit input number into the MS 16 bits | + | with saturation. Shift the resulting bits right by 16 and return the 16 | + | bit number: | + | round(L_var1) = extract_h(L_add(L_var1,32768)) | + | | + | Complexity weight : 1 | + | | + | Inputs : | + | | + | L_var1 | + | 32 bit long signed integer (Word32 ) whose value falls in the | + | range : 0x8000 0000 <= L_var1 <= 0x7fff ffff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | var_out | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | + |___________________________________________________________________________| +*/ + +Word16 round (Word32 L_var1) +{ + Word16 var_out; + Word32 L_rounded; + + L_rounded = L_add (L_var1, (Word32) 0x00008000L); +#if (WMOPS) + multiCounter[currCounter].L_add--; +#endif + var_out = extract_h (L_rounded); +#if (WMOPS) + multiCounter[currCounter].extract_h--; + multiCounter[currCounter].round++; +#endif + return (var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : L_mac | + | | + | Purpose : | + | | + | Multiply var1 by var2 and shift the result left by 1. Add the 32 bit | + | result to L_var3 with saturation, return a 32 bit result: | + | L_mac(L_var3,var1,var2) = L_add(L_var3,L_mult(var1,var2)). | + | | + | Complexity weight : 1 | + | | + | Inputs : | + | | + | L_var3 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | + | | + | var1 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | var2 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | L_var_out | + | 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | + |___________________________________________________________________________| +*/ + +Word32 L_mac (Word32 L_var3, Word16 var1, Word16 var2) +{ + Word32 L_var_out; + Word32 L_product; + + L_product = L_mult (var1, var2); +#if (WMOPS) + multiCounter[currCounter].L_mult--; +#endif + L_var_out = L_add (L_var3, L_product); +#if (WMOPS) + multiCounter[currCounter].L_add--; + multiCounter[currCounter].L_mac++; +#endif + return (L_var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : L_msu | + | | + | Purpose : | + | | + | Multiply var1 by var2 and shift the result left by 1. Subtract the 32 | + | bit result to L_var3 with saturation, return a 32 bit result: | + | L_msu(L_var3,var1,var2) = L_sub(L_var3,L_mult(var1,var2)). | + | | + | Complexity weight : 1 | + | | + | Inputs : | + | | + | L_var3 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | + | | + | var1 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | var2 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | L_var_out | + | 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | + |___________________________________________________________________________| +*/ + +Word32 L_msu (Word32 L_var3, Word16 var1, Word16 var2) +{ + Word32 L_var_out; + Word32 L_product; + + L_product = L_mult (var1, var2); +#if (WMOPS) + multiCounter[currCounter].L_mult--; +#endif + L_var_out = L_sub (L_var3, L_product); +#if (WMOPS) + multiCounter[currCounter].L_sub--; + multiCounter[currCounter].L_msu++; +#endif + return (L_var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : L_macNs | + | | + | Purpose : | + | | + | Multiply var1 by var2 and shift the result left by 1. Add the 32 bit | + | result to L_var3 without saturation, return a 32 bit result. Generate | + | carry and overflow values : | + | L_macNs(L_var3,var1,var2) = L_add_c(L_var3,L_mult(var1,var2)). | + | | + | Complexity weight : 1 | + | | + | Inputs : | + | | + | L_var3 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | + | | + | var1 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | var2 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | L_var_out | + | 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | + | | + | Caution : | + | | + | In some cases the Carry flag has to be cleared or set before using | + | operators which take into account its value. | + |___________________________________________________________________________| +*/ + +Word32 L_macNs (Word32 L_var3, Word16 var1, Word16 var2) +{ + Word32 L_var_out; + + L_var_out = L_mult (var1, var2); +#if (WMOPS) + multiCounter[currCounter].L_mult--; +#endif + L_var_out = L_add_c (L_var3, L_var_out); +#if (WMOPS) + multiCounter[currCounter].L_add_c--; + multiCounter[currCounter].L_macNs++; +#endif + return (L_var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : L_msuNs | + | | + | Purpose : | + | | + | Multiply var1 by var2 and shift the result left by 1. Subtract the 32 | + | bit result from L_var3 without saturation, return a 32 bit result. Ge- | + | nerate carry and overflow values : | + | L_msuNs(L_var3,var1,var2) = L_sub_c(L_var3,L_mult(var1,var2)). | + | | + | Complexity weight : 1 | + | | + | Inputs : | + | | + | L_var3 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | + | | + | var1 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | var2 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | L_var_out | + | 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | + | | + | Caution : | + | | + | In some cases the Carry flag has to be cleared or set before using | + | operators which take into account its value. | + |___________________________________________________________________________| +*/ + +Word32 L_msuNs (Word32 L_var3, Word16 var1, Word16 var2) +{ + Word32 L_var_out; + + L_var_out = L_mult (var1, var2); +#if (WMOPS) + multiCounter[currCounter].L_mult--; +#endif + L_var_out = L_sub_c (L_var3, L_var_out); +#if (WMOPS) + multiCounter[currCounter].L_sub_c--; + multiCounter[currCounter].L_msuNs++; +#endif + return (L_var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : L_add | + | | + | Purpose : | + | | + | 32 bits addition of the two 32 bits variables (L_var1+L_var2) with | + | overflow control and saturation; the result is set at +2147483647 when | + | overflow occurs or at -2147483648 when underflow occurs. | + | | + | Complexity weight : 2 | + | | + | Inputs : | + | | + | L_var1 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | + | | + | L_var2 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | L_var_out | + | 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | + |___________________________________________________________________________| +*/ + +Word32 L_add (Word32 L_var1, Word32 L_var2) +{ + Word32 L_var_out; + + L_var_out = L_var1 + L_var2; + + if (((L_var1 ^ L_var2) & MIN_32) == 0) + { + if ((L_var_out ^ L_var1) & MIN_32) + { + L_var_out = (L_var1 < 0) ? MIN_32 : MAX_32; + Overflow = 1; + } + } +#if (WMOPS) + multiCounter[currCounter].L_add++; +#endif + return (L_var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : L_sub | + | | + | Purpose : | + | | + | 32 bits subtraction of the two 32 bits variables (L_var1-L_var2) with | + | overflow control and saturation; the result is set at +2147483647 when | + | overflow occurs or at -2147483648 when underflow occurs. | + | | + | Complexity weight : 2 | + | | + | Inputs : | + | | + | L_var1 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | + | | + | L_var2 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | L_var_out | + | 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | + |___________________________________________________________________________| +*/ + +Word32 L_sub (Word32 L_var1, Word32 L_var2) +{ + Word32 L_var_out; + + L_var_out = L_var1 - L_var2; + + if (((L_var1 ^ L_var2) & MIN_32) != 0) + { + if ((L_var_out ^ L_var1) & MIN_32) + { + L_var_out = (L_var1 < 0L) ? MIN_32 : MAX_32; + Overflow = 1; + } + } +#if (WMOPS) + multiCounter[currCounter].L_sub++; +#endif + return (L_var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : L_add_c | + | | + | Purpose : | + | | + | Performs 32 bits addition of the two 32 bits variables (L_var1+L_var2+C)| + | with carry. No saturation. Generate carry and Overflow values. The car- | + | ry and overflow values are binary variables which can be tested and as- | + | signed values. | + | | + | Complexity weight : 2 | + | | + | Inputs : | + | | + | L_var1 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | + | | + | L_var2 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | L_var_out | + | 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | + | | + | Caution : | + | | + | In some cases the Carry flag has to be cleared or set before using | + | operators which take into account its value. | + |___________________________________________________________________________| +*/ +Word32 L_add_c (Word32 L_var1, Word32 L_var2) +{ + Word32 L_var_out; + Word32 L_test; + Flag carry_int = 0; + + L_var_out = L_var1 + L_var2 + Carry; + + L_test = L_var1 + L_var2; + + if ((L_var1 > 0) && (L_var2 > 0) && (L_test < 0)) + { + Overflow = 1; + carry_int = 0; + } + else + { + if ((L_var1 < 0) && (L_var2 < 0)) + { + if (L_test >= 0) + { + Overflow = 1; + carry_int = 1; + } + else + { + Overflow = 0; + carry_int = 1; + } + } + else + { + if (((L_var1 ^ L_var2) < 0) && (L_test >= 0)) + { + Overflow = 0; + carry_int = 1; + } + else + { + Overflow = 0; + carry_int = 0; + } + } + } + + if (Carry) + { + if (L_test == MAX_32) + { + Overflow = 1; + Carry = carry_int; + } + else + { + if (L_test == (Word32) 0xFFFFFFFFL) + { + Carry = 1; + } + else + { + Carry = carry_int; + } + } + } + else + { + Carry = carry_int; + } + +#if (WMOPS) + multiCounter[currCounter].L_add_c++; +#endif + return (L_var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : L_sub_c | + | | + | Purpose : | + | | + | Performs 32 bits subtraction of the two 32 bits variables with carry | + | (borrow) : L_var1-L_var2-C. No saturation. Generate carry and Overflow | + | values. The carry and overflow values are binary variables which can | + | be tested and assigned values. | + | | + | Complexity weight : 2 | + | | + | Inputs : | + | | + | L_var1 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | + | | + | L_var2 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | L_var_out | + | 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | + | | + | Caution : | + | | + | In some cases the Carry flag has to be cleared or set before using | + | operators which take into account its value. | + |___________________________________________________________________________| +*/ + +Word32 L_sub_c (Word32 L_var1, Word32 L_var2) +{ + Word32 L_var_out; + Word32 L_test; + Flag carry_int = 0; + + if (Carry) + { + Carry = 0; + if (L_var2 != MIN_32) + { + L_var_out = L_add_c (L_var1, -L_var2); +#if (WMOPS) + multiCounter[currCounter].L_add_c--; +#endif + } + else + { + L_var_out = L_var1 - L_var2; + if (L_var1 > 0L) + { + Overflow = 1; + Carry = 0; + } + } + } + else + { + L_var_out = L_var1 - L_var2 - (Word32) 0X00000001L; + L_test = L_var1 - L_var2; + + if ((L_test < 0) && (L_var1 > 0) && (L_var2 < 0)) + { + Overflow = 1; + carry_int = 0; + } + else if ((L_test > 0) && (L_var1 < 0) && (L_var2 > 0)) + { + Overflow = 1; + carry_int = 1; + } + else if ((L_test > 0) && ((L_var1 ^ L_var2) > 0)) + { + Overflow = 0; + carry_int = 1; + } + if (L_test == MIN_32) + { + Overflow = 1; + Carry = carry_int; + } + else + { + Carry = carry_int; + } + } + +#if (WMOPS) + multiCounter[currCounter].L_sub_c++; +#endif + return (L_var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : L_negate | + | | + | Purpose : | + | | + | Negate the 32 bit variable L_var1 with saturation; saturate in the case | + | where input is -2147483648 (0x8000 0000). | + | | + | Complexity weight : 2 | + | | + | Inputs : | + | | + | L_var1 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | L_var_out | + | 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | + |___________________________________________________________________________| +*/ + +Word32 L_negate (Word32 L_var1) +{ + Word32 L_var_out; + + L_var_out = (L_var1 == MIN_32) ? MAX_32 : -L_var1; +#if (WMOPS) + multiCounter[currCounter].L_negate++; +#endif + return (L_var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : mult_r | + | | + | Purpose : | + | | + | Same as mult with rounding, i.e.: | + | mult_r(var1,var2) = extract_l(L_shr(((var1 * var2) + 16384),15)) and | + | mult_r(-32768,-32768) = 32767. | + | | + | Complexity weight : 2 | + | | + | Inputs : | + | | + | var1 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | var2 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | var_out | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | + |___________________________________________________________________________| +*/ + +Word16 mult_r (Word16 var1, Word16 var2) +{ + Word16 var_out; + Word32 L_product_arr; + + L_product_arr = (Word32) var1 *(Word32) var2; /* product */ + L_product_arr += (Word32) 0x00004000L; /* round */ + L_product_arr &= (Word32) 0xffff8000L; + L_product_arr >>= 15; /* shift */ + + if (L_product_arr & (Word32) 0x00010000L) /* sign extend when necessary */ + { + L_product_arr |= (Word32) 0xffff0000L; + } + var_out = saturate (L_product_arr); +#if (WMOPS) + multiCounter[currCounter].mult_r++; +#endif + return (var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : L_shl | + | | + | Purpose : | + | | + | Arithmetically shift the 32 bit input L_var1 left var2 positions. Zero | + | fill the var2 LSB of the result. If var2 is negative, arithmetically | + | shift L_var1 right by -var2 with sign extension. Saturate the result in | + | case of underflows or overflows. | + | | + | Complexity weight : 2 | + | | + | Inputs : | + | | + | L_var1 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | + | | + | var2 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | L_var_out | + | 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | + |___________________________________________________________________________| +*/ + +Word32 L_shl (Word32 L_var1, Word16 var2) +{ + Word32 L_var_out=0; + + if (var2 <= 0) + { + if (var2 < -32) + var2 = -32; + L_var_out = L_shr (L_var1, -var2); +#if (WMOPS) + multiCounter[currCounter].L_shr--; +#endif + } + else + { + for (; var2 > 0; var2--) + { + if (L_var1 > (Word32) 0X3fffffffL) + { + Overflow = 1; + L_var_out = MAX_32; + break; + } + else + { + if (L_var1 < (Word32) 0xc0000000L) + { + Overflow = 1; + L_var_out = MIN_32; + break; + } + } + L_var1 *= 2; + L_var_out = L_var1; + } + } +#if (WMOPS) + multiCounter[currCounter].L_shl++; +#endif + return (L_var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : L_shr | + | | + | Purpose : | + | | + | Arithmetically shift the 32 bit input L_var1 right var2 positions with | + | sign extension. If var2 is negative, arithmetically shift L_var1 left | + | by -var2 and zero fill the -var2 LSB of the result. Saturate the result | + | in case of underflows or overflows. | + | | + | Complexity weight : 2 | + | | + | Inputs : | + | | + | L_var1 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | + | | + | var2 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | L_var_out | + | 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | + |___________________________________________________________________________| +*/ + +Word32 L_shr (Word32 L_var1, Word16 var2) +{ + Word32 L_var_out; + + if (var2 < 0) + { + if (var2 < -32) + var2 = -32; + L_var_out = L_shl (L_var1, -var2); +#if (WMOPS) + multiCounter[currCounter].L_shl--; +#endif + } + else + { + if (var2 >= 31) + { + L_var_out = (L_var1 < 0L) ? -1 : 0; + } + else + { + if (L_var1 < 0) + { + L_var_out = ~((~L_var1) >> var2); + } + else + { + L_var_out = L_var1 >> var2; + } + } + } +#if (WMOPS) + multiCounter[currCounter].L_shr++; +#endif + return (L_var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : shr_r | + | | + | Purpose : | + | | + | Same as shr(var1,var2) but with rounding. Saturate the result in case of| + | underflows or overflows : | + | - If var2 is greater than zero : | + | if (sub(shl(shr(var1,var2),1),shr(var1,sub(var2,1)))) | + | is equal to zero | + | then | + | shr_r(var1,var2) = shr(var1,var2) | + | else | + | shr_r(var1,var2) = add(shr(var1,var2),1) | + | - If var2 is less than or equal to zero : | + | shr_r(var1,var2) = shr(var1,var2). | + | | + | Complexity weight : 2 | + | | + | Inputs : | + | | + | var1 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | var2 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | var_out | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | + |___________________________________________________________________________| +*/ + +Word16 shr_r (Word16 var1, Word16 var2) +{ + Word16 var_out; + + if (var2 > 15) + { + var_out = 0; + } + else + { + var_out = shr (var1, var2); +#if (WMOPS) + multiCounter[currCounter].shr--; +#endif + + if (var2 > 0) + { + if ((var1 & ((Word16) 1 << (var2 - 1))) != 0) + { + var_out++; + } + } + } +#if (WMOPS) + multiCounter[currCounter].shr_r++; +#endif + return (var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : mac_r | + | | + | Purpose : | + | | + | Multiply var1 by var2 and shift the result left by 1. Add the 32 bit | + | result to L_var3 with saturation. Round the LS 16 bits of the result | + | into the MS 16 bits with saturation and shift the result right by 16. | + | Return a 16 bit result. | + | mac_r(L_var3,var1,var2) = round(L_mac(L_var3,var1,var2)) | + | | + | Complexity weight : 2 | + | | + | Inputs : | + | | + | L_var3 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | + | | + | var1 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | var2 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | var_out | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0x0000 8000 <= L_var_out <= 0x0000 7fff. | + |___________________________________________________________________________| +*/ + +Word16 mac_r (Word32 L_var3, Word16 var1, Word16 var2) +{ + Word16 var_out; + + L_var3 = L_mac (L_var3, var1, var2); +#if (WMOPS) + multiCounter[currCounter].L_mac--; +#endif + L_var3 = L_add (L_var3, (Word32) 0x00008000L); +#if (WMOPS) + multiCounter[currCounter].L_add--; +#endif + var_out = extract_h (L_var3); +#if (WMOPS) + multiCounter[currCounter].extract_h--; + multiCounter[currCounter].mac_r++; +#endif + return (var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : msu_r | + | | + | Purpose : | + | | + | Multiply var1 by var2 and shift the result left by 1. Subtract the 32 | + | bit result to L_var3 with saturation. Round the LS 16 bits of the res- | + | ult into the MS 16 bits with saturation and shift the result right by | + | 16. Return a 16 bit result. | + | msu_r(L_var3,var1,var2) = round(L_msu(L_var3,var1,var2)) | + | | + | Complexity weight : 2 | + | | + | Inputs : | + | | + | L_var3 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | + | | + | var1 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | var2 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | var_out | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0x0000 8000 <= L_var_out <= 0x0000 7fff. | + |___________________________________________________________________________| +*/ + +Word16 msu_r (Word32 L_var3, Word16 var1, Word16 var2) +{ + Word16 var_out; + + L_var3 = L_msu (L_var3, var1, var2); +#if (WMOPS) + multiCounter[currCounter].L_msu--; +#endif + L_var3 = L_add (L_var3, (Word32) 0x00008000L); +#if (WMOPS) + multiCounter[currCounter].L_add--; +#endif + var_out = extract_h (L_var3); +#if (WMOPS) + multiCounter[currCounter].extract_h--; + multiCounter[currCounter].msu_r++; +#endif + return (var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : L_deposit_h | + | | + | Purpose : | + | | + | Deposit the 16 bit var1 into the 16 MS bits of the 32 bit output. The | + | 16 LS bits of the output are zeroed. | + | | + | Complexity weight : 2 | + | | + | Inputs : | + | | + | var1 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | L_var_out | + | 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= var_out <= 0x7fff 0000. | + |___________________________________________________________________________| +*/ + +Word32 L_deposit_h (Word16 var1) +{ + Word32 L_var_out; + + L_var_out = (Word32) var1 << 16; +#if (WMOPS) + multiCounter[currCounter].L_deposit_h++; +#endif + return (L_var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : L_deposit_l | + | | + | Purpose : | + | | + | Deposit the 16 bit var1 into the 16 LS bits of the 32 bit output. The | + | 16 MS bits of the output are sign extended. | + | | + | Complexity weight : 2 | + | | + | Inputs : | + | | + | var1 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | L_var_out | + | 32 bit long signed integer (Word32) whose value falls in the | + | range : 0xFFFF 8000 <= var_out <= 0x0000 7fff. | + |___________________________________________________________________________| +*/ + +Word32 L_deposit_l (Word16 var1) +{ + Word32 L_var_out; + + L_var_out = (Word32) var1; +#if (WMOPS) + multiCounter[currCounter].L_deposit_l++; +#endif + return (L_var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : L_shr_r | + | | + | Purpose : | + | | + | Same as L_shr(L_var1,var2) but with rounding. Saturate the result in | + | case of underflows or overflows : | + | - If var2 is greater than zero : | + | if (L_sub(L_shl(L_shr(L_var1,var2),1),L_shr(L_var1,sub(var2,1))))| + | is equal to zero | + | then | + | L_shr_r(L_var1,var2) = L_shr(L_var1,var2) | + | else | + | L_shr_r(L_var1,var2) = L_add(L_shr(L_var1,var2),1) | + | - If var2 is less than or equal to zero : | + | L_shr_r(L_var1,var2) = L_shr(L_var1,var2). | + | | + | Complexity weight : 3 | + | | + | Inputs : | + | | + | L_var1 | + | 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= var1 <= 0x7fff ffff. | + | | + | var2 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | L_var_out | + | 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= var_out <= 0x7fff ffff. | + |___________________________________________________________________________| +*/ + +Word32 L_shr_r (Word32 L_var1, Word16 var2) +{ + Word32 L_var_out; + + if (var2 > 31) + { + L_var_out = 0; + } + else + { + L_var_out = L_shr (L_var1, var2); +#if (WMOPS) + multiCounter[currCounter].L_shr--; +#endif + if (var2 > 0) + { + if ((L_var1 & ((Word32) 1 << (var2 - 1))) != 0) + { + L_var_out++; + } + } + } +#if (WMOPS) + multiCounter[currCounter].L_shr_r++; +#endif + return (L_var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : L_abs | + | | + | Purpose : | + | | + | Absolute value of L_var1; Saturate in case where the input is | + | -214783648 | + | | + | Complexity weight : 3 | + | | + | Inputs : | + | | + | L_var1 | + | 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= var1 <= 0x7fff ffff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | L_var_out | + | 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x0000 0000 <= var_out <= 0x7fff ffff. | + |___________________________________________________________________________| +*/ + +Word32 L_abs (Word32 L_var1) +{ + Word32 L_var_out; + + if (L_var1 == MIN_32) + { + L_var_out = MAX_32; + } + else + { + if (L_var1 < 0) + { + L_var_out = -L_var1; + } + else + { + L_var_out = L_var1; + } + } + +#if (WMOPS) + multiCounter[currCounter].L_abs++; +#endif + return (L_var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : L_sat | + | | + | Purpose : | + | | + | 32 bit L_var1 is set to 2147483647 if an overflow occured or to | + | -2147483648 if an underflow occured on the most recent L_add_c, | + | L_sub_c, L_macNs or L_msuNs operations. The carry and overflow values | + | are binary values which can be tested and assigned values. | + | | + | Complexity weight : 4 | + | | + | Inputs : | + | | + | L_var1 | + | 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= var1 <= 0x7fff ffff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | L_var_out | + | 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= var_out <= 0x7fff ffff. | + |___________________________________________________________________________| +*/ + +Word32 L_sat (Word32 L_var1) +{ + Word32 L_var_out; + + L_var_out = L_var1; + + if (Overflow) + { + + if (Carry) + { + L_var_out = MIN_32; + } + else + { + L_var_out = MAX_32; + } + + Carry = 0; + Overflow = 0; + } +#if (WMOPS) + multiCounter[currCounter].L_sat++; +#endif + return (L_var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : norm_s | + | | + | Purpose : | + | | + | Produces the number of left shift needed to normalize the 16 bit varia- | + | ble var1 for positive values on the interval with minimum of 16384 and | + | maximum of 32767, and for negative values on the interval with minimum | + | of -32768 and maximum of -16384; in order to normalize the result, the | + | following operation must be done : | + | norm_var1 = shl(var1,norm_s(var1)). | + | | + | Complexity weight : 15 | + | | + | Inputs : | + | | + | var1 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | var_out | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0x0000 0000 <= var_out <= 0x0000 000f. | + |___________________________________________________________________________| +*/ + +Word16 norm_s (Word16 var1) +{ + Word16 var_out; + + if (var1 == 0) + { + var_out = 0; + } + else + { + if (var1 == (Word16) 0xffff) + { + var_out = 15; + } + else + { + if (var1 < 0) + { + var1 = ~var1; + } + for (var_out = 0; var1 < 0x4000; var_out++) + { + var1 <<= 1; + } + } + } + +#if (WMOPS) + multiCounter[currCounter].norm_s++; +#endif + return (var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : div_s | + | | + | Purpose : | + | | + | Produces a result which is the fractional integer division of var1 by | + | var2; var1 and var2 must be positive and var2 must be greater or equal | + | to var1; the result is positive (leading bit equal to 0) and truncated | + | to 16 bits. | + | If var1 = var2 then div(var1,var2) = 32767. | + | | + | Complexity weight : 18 | + | | + | Inputs : | + | | + | var1 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0x0000 0000 <= var1 <= var2 and var2 != 0. | + | | + | var2 | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : var1 <= var2 <= 0x0000 7fff and var2 != 0. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | var_out | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0x0000 0000 <= var_out <= 0x0000 7fff. | + | It's a Q15 value (point between b15 and b14). | + |___________________________________________________________________________| +*/ + +Word16 div_s (Word16 var1, Word16 var2) +{ + Word16 var_out = 0; + Word16 iteration; + Word32 L_num; + Word32 L_denom; + + if ((var1 > var2) || (var1 < 0) || (var2 < 0)) + { + printf ("Division Error var1=%d var2=%d\n", var1, var2); + abort(); /* exit (0); */ + } + if (var2 == 0) + { + printf ("Division by 0, Fatal error \n"); + abort(); /* exit (0); */ + } + if (var1 == 0) + { + var_out = 0; + } + else + { + if (var1 == var2) + { + var_out = MAX_16; + } + else + { + L_num = L_deposit_l (var1); +#if (WMOPS) + multiCounter[currCounter].L_deposit_l--; +#endif + L_denom = L_deposit_l (var2); +#if (WMOPS) + multiCounter[currCounter].L_deposit_l--; +#endif + + for (iteration = 0; iteration < 15; iteration++) + { + var_out <<= 1; + L_num <<= 1; + + if (L_num >= L_denom) + { + L_num = L_sub (L_num, L_denom); +#if (WMOPS) + multiCounter[currCounter].L_sub--; +#endif + var_out = add (var_out, 1); +#if (WMOPS) + multiCounter[currCounter].add--; +#endif + } + } + } + } + +#if (WMOPS) + multiCounter[currCounter].div_s++; +#endif + return (var_out); +} + +/*___________________________________________________________________________ + | | + | Function Name : norm_l | + | | + | Purpose : | + | | + | Produces the number of left shifts needed to normalize the 32 bit varia-| + | ble L_var1 for positive values on the interval with minimum of | + | 1073741824 and maximum of 2147483647, and for negative values on the in-| + | terval with minimum of -2147483648 and maximum of -1073741824; in order | + | to normalize the result, the following operation must be done : | + | norm_L_var1 = L_shl(L_var1,norm_l(L_var1)). | + | | + | Complexity weight : 30 | + | | + | Inputs : | + | | + | L_var1 | + | 32 bit long signed integer (Word32) whose value falls in the | + | range : 0x8000 0000 <= var1 <= 0x7fff ffff. | + | | + | Outputs : | + | | + | none | + | | + | Return Value : | + | | + | var_out | + | 16 bit short signed integer (Word16) whose value falls in the | + | range : 0x0000 0000 <= var_out <= 0x0000 001f. | + |___________________________________________________________________________| +*/ + +Word16 norm_l (Word32 L_var1) +{ + Word16 var_out; + + if (L_var1 == 0) + { + var_out = 0; + } + else + { + if (L_var1 == (Word32) 0xffffffffL) + { + var_out = 31; + } + else + { + if (L_var1 < 0) + { + L_var1 = ~L_var1; + } + for (var_out = 0; L_var1 < (Word32) 0x40000000L; var_out++) + { + L_var1 <<= 1; + } + } + } + +#if (WMOPS) + multiCounter[currCounter].norm_l++; +#endif + return (var_out); +} + diff --git a/imbe_vocoder/src/lib/ch_decode.cc b/imbe_vocoder/src/lib/ch_decode.cc new file mode 100644 index 0000000..4eea06a --- /dev/null +++ b/imbe_vocoder/src/lib/ch_decode.cc @@ -0,0 +1,182 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + +#include "typedef.h" +#include "globals.h" +#include "imbe.h" +#include "basic_op.h" +#include "ch_decode.h" +#include "aux_sub.h" + + +void decode_frame_vector(IMBE_PARAM *imbe_param, Word16 *frame_vector) +{ + Word16 bit_stream[BIT_STREAM_LEN]; + Word16 i, vec_num, tmp, tmp1, tmp2, bit_thr, shift; + Word16 *b_ptr, *ba_ptr, index0; + Word32 L_tmp; + + imbe_param->b_vec[0] = (shr(frame_vector[0], 4) & 0xFC) | (shr(frame_vector[7], 1) & 0x3); + + tmp = ((imbe_param->b_vec[0] & 0xFF) << 1) + 0x4F; // Convert b_vec[0] to unsigned Q15.1 format and add 39.5 + + //imbe_param->ff = 4./((double)imbe_param->b_vec[0] + 39.5); + + // Calculate fundamental frequency with higher precession + shift = norm_s(tmp); + tmp1 = tmp << shift; + + tmp2 = div_s(0x4000, tmp1); + imbe_param->fund_freq = L_shr(L_deposit_h(tmp2), 11 - shift); + + L_tmp = L_sub(0x40000000, L_mult(tmp1, tmp2)); + tmp2 = div_s(extract_l(L_shr(L_tmp, 2)), tmp1); + L_tmp = L_shr(L_deposit_l(tmp2), 11 - shift - 2); + imbe_param->fund_freq = L_add(imbe_param->fund_freq, L_tmp); + + //printf("%X %X \n", imbe_param->fund_freq, (Word32)(imbe_param->ff * (double)((UWord32)1<<31))); + + tmp = (tmp + 0x2) >> 3; // Calculate (b0 + 39.5 + 1)/4 + imbe_param->num_harms = ((UWord32)CNST_0_9254_Q0_16 * tmp) >> 16; + + if(imbe_param->num_harms <= 36) + imbe_param->num_bands = extract_h((UWord32)(imbe_param->num_harms + 2) * CNST_0_33_Q0_16); // fix((L+2)/3) + else + imbe_param->num_bands = NUM_BANDS_MAX; + + // Convert input vector (from b_3 to b_L+1) to bit stream + bit_stream[0] = (frame_vector[0] & 0x4)?1:0; + bit_stream[1] = (frame_vector[0] & 0x2)?1:0; + bit_stream[2] = (frame_vector[0] & 0x1)?1:0; + + bit_stream[BIT_STREAM_LEN - 3] = (frame_vector[7] & 0x40)?1:0; + bit_stream[BIT_STREAM_LEN - 2] = (frame_vector[7] & 0x20)?1:0; + bit_stream[BIT_STREAM_LEN - 1] = (frame_vector[7] & 0x10)?1:0; + + + index0 = 3 + 3 * 12 - 1; + for(vec_num = 3; vec_num >= 1; vec_num--) + { + tmp = frame_vector[vec_num]; + for(i = 0; i < 12; i++) + { + bit_stream[index0] = (tmp & 0x1)?1:0; + tmp >>= 1; + index0--; + } + } + + index0 = 3 + 3 * 12 + 3 * 11 - 1; + for(vec_num = 6; vec_num >= 4; vec_num--) + { + tmp = frame_vector[vec_num]; + for(i = 0; i < 11; i++) + { + bit_stream[index0] = (tmp & 0x1)?1:0; + tmp >>= 1; + index0--; + } + } + + // Rebuild b1 + index0 = 3 + 3 * 12; + tmp = 0; + for(i = 0; i < imbe_param->num_bands; i++) + tmp = (tmp << 1) | bit_stream[index0++]; + + imbe_param->b_vec[1] = tmp; + + // Rebuild b2 + tmp = 0; + tmp |= bit_stream[index0++] << 1; + tmp |= bit_stream[index0++]; + imbe_param->b_vec[2] = (frame_vector[0] & 0x38) | (tmp << 1) | (shr(frame_vector[7], 3) & 0x01); + + // Shift the rest of sequence + tmp = imbe_param->num_bands + 2; // shift + for(; index0 < BIT_STREAM_LEN; index0++) + bit_stream[index0 - tmp] = bit_stream[index0]; + + // Priority ReScanning + b_ptr = &imbe_param->b_vec[3]; + ba_ptr = imbe_param->bit_alloc; + for(i = 0; i < B_NUM; i++) + ba_ptr[i] = b_ptr[i] = 0; + + + // Unpack bit allocation table's item + get_bit_allocation(imbe_param->num_harms, imbe_param->bit_alloc); + + index0 = 0; + bit_thr = (imbe_param->num_harms == 0xb)?9:ba_ptr[0]; + + while(index0 < BIT_STREAM_LEN - imbe_param->num_bands - 2) + { + for(i = 0; i < imbe_param->num_harms - 1; i++) + if(bit_thr && bit_thr <= ba_ptr[i]) + b_ptr[i] = (b_ptr[i] << 1) | bit_stream[index0++]; + bit_thr--; + } + + // Synchronization Bit Decoding + imbe_param->b_vec[imbe_param->num_harms + 2] = frame_vector[7] & 1; +} + + +void v_uv_decode(IMBE_PARAM *imbe_param) +{ + Word16 num_harms; + Word16 num_bands; + Word16 vu_vec, *p_v_uv_dsn, mask, i, uv_cnt; + + num_harms = imbe_param->num_harms; + num_bands = imbe_param->num_bands; + vu_vec = imbe_param->b_vec[1]; + + p_v_uv_dsn = imbe_param->v_uv_dsn; + + mask = 1 << (num_bands - 1); + + v_zap(p_v_uv_dsn, NUM_HARMS_MAX); + + i = 0; uv_cnt = 0; + while(num_harms--) + { + if(vu_vec & mask) + *p_v_uv_dsn++ = 1; + else + { + *p_v_uv_dsn++ = 0; + uv_cnt++; + } + + if(++i == 3) + { + if(num_bands > 1) + { + num_bands--; + mask >>= 1; + } + i = 0; + } + } + imbe_param->l_uv = uv_cnt; +} diff --git a/imbe_vocoder/src/lib/ch_decode.h b/imbe_vocoder/src/lib/ch_decode.h new file mode 100644 index 0000000..027ab11 --- /dev/null +++ b/imbe_vocoder/src/lib/ch_decode.h @@ -0,0 +1,32 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + +#ifndef _CH_DECODE +#define _CH_DECODE + +#include "typedef.h" + +#define BIT_STREAM_LEN (3 + 3*12 + 3*11 + 3) + +void decode_frame_vector(IMBE_PARAM *imbe_param, Word16 *frame_vector); +void v_uv_decode(IMBE_PARAM *imbe_param); + +#endif diff --git a/imbe_vocoder/src/lib/ch_encode.cc b/imbe_vocoder/src/lib/ch_encode.cc new file mode 100644 index 0000000..eeff592 --- /dev/null +++ b/imbe_vocoder/src/lib/ch_encode.cc @@ -0,0 +1,110 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + + +#include "typedef.h" +#include "globals.h" +#include "imbe.h" +#include "basic_op.h" +#include "ch_encode.h" +#include "aux_sub.h" + + +void encode_frame_vector(IMBE_PARAM *imbe_param, Word16 *frame_vector) +{ + Word16 bit_stream[EN_BIT_STREAM_LEN], index0, bit_thr, bit_mask, i; + Word16 vec_num, num_harms, num_bands, tmp; + Word16 *ba_ptr, *b_ptr; + + num_harms = imbe_param->num_harms; + num_bands = imbe_param->num_bands; + + v_zap(frame_vector, 8); + + // Unpack bit allocation table's item + get_bit_allocation(num_harms, imbe_param->bit_alloc); + + // Priority Scanning + index0 = 0; + ba_ptr = imbe_param->bit_alloc; + bit_thr = (num_harms == 0xb)?9:ba_ptr[0]; + bit_mask = shl(1, bit_thr - 1); + + while(index0 < EN_BIT_STREAM_LEN - (num_bands - 3)) + { + b_ptr = &imbe_param->b_vec[3]; + for(i = 0; i < num_harms - 1; i++) + if(bit_thr && bit_thr <= ba_ptr[i]) + bit_stream[index0++] = (b_ptr[i] & bit_mask)?1:0; + + bit_thr--; + bit_mask = shr(bit_mask, 1); + } + + frame_vector[0] = shl(imbe_param->b_vec[0] & 0xFC, 4) | imbe_param->b_vec[2] & 0x38; + + index0 = 0; + frame_vector[0] |= (bit_stream[index0++])?4:0; + frame_vector[0] |= (bit_stream[index0++])?2:0; + frame_vector[0] |= (bit_stream[index0++])?1:0; + + for(vec_num = 1; vec_num <= 3; vec_num++) + { + tmp = 0; + for(i = 0; i < 12; i++) + { + tmp <<= 1; + tmp |= bit_stream[index0++]; + } + frame_vector[vec_num] = tmp; + } + + index0 -= num_bands + 2; + + bit_mask = shl(1, num_bands - 1); + for(i = 0; i < num_bands; i++) + { + bit_stream[index0++] = (imbe_param->b_vec[1] & bit_mask)?1:0; + bit_mask >>= 1; + } + + bit_stream[index0++] = (imbe_param->b_vec[2] & 0x04)?1:0; + bit_stream[index0++] = (imbe_param->b_vec[2] & 0x02)?1:0; + + index0 -= num_bands + 2; + + for(vec_num = 4; vec_num <= 6; vec_num++) + { + tmp = 0; + for(i = 0; i < 11; i++) + { + tmp <<= 1; + tmp |= bit_stream[index0++]; + } + frame_vector[vec_num] = tmp; + } + + frame_vector[7] = shl(imbe_param->b_vec[0] & 0x03, 1) | shl(imbe_param->b_vec[2] & 0x01, 3); + frame_vector[7] |= (bit_stream[index0++])?0x40:0; + frame_vector[7] |= (bit_stream[index0++])?0x20:0; + frame_vector[7] |= (bit_stream[index0++])?0x10:0; + frame_vector[7] |= (imbe_param->b_vec[num_harms + 2])?0x01:0; +} diff --git a/imbe_vocoder/src/lib/ch_encode.h b/imbe_vocoder/src/lib/ch_encode.h new file mode 100644 index 0000000..0a9b8de --- /dev/null +++ b/imbe_vocoder/src/lib/ch_encode.h @@ -0,0 +1,32 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + + +#ifndef _CH_ENCODE +#define _CH_ENCODE + +#define EN_BIT_STREAM_LEN (3 + 3*12 + 6 + 2*11 + 3) + + +void encode_frame_vector(IMBE_PARAM *imbe_param, Word16 *frame_vector); + + +#endif diff --git a/imbe_vocoder/src/lib/dc_rmv.cc b/imbe_vocoder/src/lib/dc_rmv.cc new file mode 100644 index 0000000..946174c --- /dev/null +++ b/imbe_vocoder/src/lib/dc_rmv.cc @@ -0,0 +1,66 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + +#include "typedef.h" +#include "globals.h" +#include "imbe.h" +#include "aux_sub.h" +#include "basic_op.h" +#include "math_sub.h" +#include "dc_rmv.h" + + +#define CNST_0_99_Q1_15 0x7EB8 + + +//----------------------------------------------------------------------------- +// PURPOSE: +// High-pass filter to remove DC +// +// +// INPUT: +// *sigin - pointer to input signal buffer +// *sigout - pointer to output signal buffer +// *mem - pointer to filter's memory element +// len - number of input signal samples +// +// OUTPUT: +// None +// +// RETURN: +// Saved filter state in mem +// +//----------------------------------------------------------------------------- +void dc_rmv(Word16 *sigin, Word16 *sigout, Word32 *mem, Word16 len) +{ + Word32 L_tmp, L_mem; + + L_mem = *mem; + while(len--) + { + L_tmp = L_deposit_h(*sigin++); + L_mem = L_add(L_mem, L_tmp); + *sigout++ = round(L_mem); + L_mem = L_mpy_ls(L_mem, CNST_0_99_Q1_15); + L_mem = L_sub(L_mem, L_tmp); + } + *mem = L_mem; +} diff --git a/imbe_vocoder/src/lib/dc_rmv.h b/imbe_vocoder/src/lib/dc_rmv.h new file mode 100644 index 0000000..d36393b --- /dev/null +++ b/imbe_vocoder/src/lib/dc_rmv.h @@ -0,0 +1,46 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + + +#ifndef _DC_RMV +#define _DC_RMV + +//----------------------------------------------------------------------------- +// PURPOSE: +// High-pass filter to remove DC +// +// +// INPUT: +// *sigin - pointer to input signal buffer +// *sigout - pointer to output signal buffer +// *mem - pointer to filter's memory element +// len - number of input signal samples +// +// OUTPUT: +// None +// +// RETURN: +// Saved filter state in mem +// +//----------------------------------------------------------------------------- +void dc_rmv(Word16 *sigin, Word16 *sigout, Word32 *mem, Word16 len); + +#endif diff --git a/imbe_vocoder/src/lib/decode.cc b/imbe_vocoder/src/lib/decode.cc new file mode 100644 index 0000000..d187523 --- /dev/null +++ b/imbe_vocoder/src/lib/decode.cc @@ -0,0 +1,60 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + +#include "typedef.h" +#include "globals.h" +#include "imbe.h" +#include "ch_decode.h" +#include "sa_decode.h" +#include "sa_enh.h" +#include "v_synt.h" +#include "uv_synt.h" +#include "basic_op.h" +#include "aux_sub.h" +#include "encode.h" +#include "dsp_sub.h" +#include "op25_imbe_vocoder.h" + + + +void op25_imbe_vocoder::decode_init(void) +{ + v_synt_init(); + uv_synt_init(); + sa_decode_init(); +} + + +void op25_imbe_vocoder::decode(IMBE_PARAM *imbe_param, Word16 *frame_vector, Word16 *snd) +{ + Word16 snd_tmp[FRAME]; + Word16 j; + + decode_frame_vector(imbe_param, frame_vector); + v_uv_decode(imbe_param); + sa_decode(imbe_param); + sa_enh(imbe_param); + v_synt(imbe_param, snd); + uv_synt(imbe_param, snd_tmp); + + for(j = 0; j < FRAME; j++) + snd[j] = add(snd[j], snd_tmp[j]); +} diff --git a/imbe_vocoder/src/lib/decode.h b/imbe_vocoder/src/lib/decode.h new file mode 100644 index 0000000..177dc64 --- /dev/null +++ b/imbe_vocoder/src/lib/decode.h @@ -0,0 +1,30 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + + +#ifndef _DECODE +#define _DECODE +#if 0 +void decode_init(void); +void decode(IMBE_PARAM *imbe_param, Word16 *frame_vector, Word16 *snd); +#endif +#endif + diff --git a/imbe_vocoder/src/lib/dsp_sub.cc b/imbe_vocoder/src/lib/dsp_sub.cc new file mode 100644 index 0000000..05df8bb --- /dev/null +++ b/imbe_vocoder/src/lib/dsp_sub.cc @@ -0,0 +1,278 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + +#include "typedef.h" +#include "basic_op.h" +#include "imbe.h" +#include "tbls.h" +#include "dsp_sub.h" +#include "math_sub.h" +#include "encode.h" +#include "op25_imbe_vocoder.h" + +//----------------------------------------------------------------------------- +// PURPOSE: +// Perform inverse DCT +// +// +// INPUT: +// in - pointer to input data +// m_lim - input data's size +// i_lim - result's size +// out - pointer to save result +// +// OUTPUT: +// None +// +// RETURN: +// Saved in out result of conversion +// +//----------------------------------------------------------------------------- +void op25_imbe_vocoder::idct(Word16 *in, Word16 m_lim, Word16 i_lim, Word16 *out) +{ + UWord16 angl_step, angl_intl, angl_intl_2; + UWord16 angl_acc; + Word32 sum; + Word16 i, m; + + if(m_lim == 1) + { + angl_intl = CNST_0_5_Q1_15; + angl_intl_2 = CNST_1_0_Q1_15; + } + else + { + angl_intl = div_s ((Word16) CNST_0_5_Q5_11, m_lim << 11); // calculate 0.5/m_lim + angl_intl_2 = shl(angl_intl, 1); + } + + angl_step = angl_intl; + for(i = 0; i < i_lim; i++) + { + sum = 0; + angl_acc = angl_step; + for(m = 1; m < m_lim; m++) + { + sum = L_add(sum, L_shr( L_mult(in[m], cos_fxp(angl_acc)), 7)); + angl_acc += angl_step; + } + sum = L_add(sum, L_shr( L_deposit_h(in[0]), 8)); + out[i] = extract_l(L_shr_r (sum, 8)); + angl_step += angl_intl_2; + } +} + +//----------------------------------------------------------------------------- +// PURPOSE: +// Perform DCT +// +// +// INPUT: +// in - pointer to input data +// m_lim - input data's size +// i_lim - result's size +// out - pointer to save result +// +// OUTPUT: +// None +// +// RETURN: +// Saved in out result of conversion +// +//----------------------------------------------------------------------------- +void op25_imbe_vocoder::dct(Word16 *in, Word16 m_lim, Word16 i_lim, Word16 *out) +{ + UWord16 angl_step, angl_intl, angl_intl_2, angl_begin; + UWord16 angl_acc; + Word32 sum; + Word16 i, m; + + if(m_lim == 1) + { + angl_intl = CNST_0_5_Q1_15; + angl_intl_2 = CNST_1_0_Q1_15; + } + else + { + angl_intl = div_s ((Word16) CNST_0_5_Q5_11, m_lim << 11); // calculate 0.5/m_lim + angl_intl_2 = shl(angl_intl, 1); + } + + // Calculate first coefficient + sum = 0; + for(m = 0; m < m_lim; m++) + sum = L_add(sum, L_deposit_l(in[m])); + out[0] = extract_l(L_mpy_ls(sum, angl_intl_2)); + + // Calculate the others coefficients + angl_begin = angl_intl; + angl_step = angl_intl_2; + for(i = 1; i < i_lim; i++) + { + sum = 0; + angl_acc = angl_begin; + for(m = 0; m < m_lim; m++) + { + sum = L_add(sum, L_deposit_l(mult(in[m], cos_fxp(angl_acc)))); + angl_acc += angl_step; + } + out[i] = extract_l(L_mpy_ls(sum, angl_intl_2)); + + angl_step += angl_intl_2; + angl_begin += angl_intl; + } +} + + + + +void op25_imbe_vocoder::fft_init(void) +{ + Word16 i, fft_len2, shift, step, theta; + + fft_len2 = shr(FFTLENGTH, 1); + shift = norm_s(fft_len2); + step = shl(2, shift); + theta = 0; + + for(i = 0; i <= fft_len2; i++) + { + wr_array[i] = cos_fxp(theta); + wi_array[i] = sin_fxp(theta); + if(i >= (fft_len2 - 1)) + theta = ONE_Q15; + else + theta = add(theta, step); + } +} + + +// Subroutine FFT: Fast Fourier Transform +// *************************************************************** +// * Replaces data by its DFT, if isign is 1, or replaces data * +// * by inverse DFT times nn if isign is -1. data is a complex * +// * array of length nn, input as a real array of length 2*nn. * +// * nn MUST be an integer power of two. This is not checked * +// * The real part of the number should be in the zeroeth * +// * of data , and the imaginary part should be in the next * +// * element. Hence all the real parts should have even indeces * +// * and the imaginary parts, odd indeces. * +// * * +// * Data is passed in an array starting in position 0, but the * +// * code is copied from Fortran so uses an internal pointer * +// * which accesses position 0 as position 1, etc. * +// * * +// * This code uses e+jwt sign convention, so isign should be * +// * reversed for e-jwt. * +// *************************************************************** +// +// Q values: +// datam1 - Q14 +// isign - Q15 + +#define SWAP(a,b) temp1 = (a);(a) = (b); (b) = temp1 + +void op25_imbe_vocoder::fft(Word16 *datam1, Word16 nn, Word16 isign) +{ + Word16 n, mmax, m, j, istep, i; + Word16 wr, wi, temp1; + Word32 L_tempr, L_tempi; + Word16 *data; + Word32 L_temp1, L_temp2; + Word16 index, index_step; + + // Use pointer indexed from 1 instead of 0 + data = &datam1[-1]; + + n = shl(nn,1); + j = 1; + for( i = 1; i < n; i+=2 ) + { + if ( j > i) + { + SWAP(data[j],data[i]); + SWAP(data[j+1],data[i+1]); + } + m = nn; + while ( m >= 2 && j > m ) + { + j = sub(j,m); + m = shr(m,1); + } + j = add(j,m); + } + mmax = 2; + + // initialize index step + index_step = nn; + + while ( n > mmax) + { + istep = shl(mmax,1); // istep = 2 * mmax + + index = 0; + index_step = shr(index_step,1); + + wr = ONE_Q15; + wi = 0; + for ( m = 1; m < mmax; m+=2) + { + for ( i = m; i <= n; i += istep) + { + j = i + mmax; + + // tempr = wr * data[j] - wi * data[j+1] + L_temp1 = L_shr(L_mult(wr,data[j]),1); + L_temp2 = L_shr(L_mult(wi,data[j+1]),1); + L_tempr = L_sub(L_temp1,L_temp2); + + // tempi = wr * data[j+1] + wi * data[j] + L_temp1 = L_shr(L_mult(wr,data[j+1]),1); + L_temp2 = L_shr(L_mult(wi,data[j]),1); + L_tempi = L_add(L_temp1,L_temp2); + + + // data[j] = data[i] - tempr + L_temp1 = L_shr(L_deposit_h(data[i]),1); + data[j] = round(L_sub(L_temp1,L_tempr)); + + // data[i] += tempr + data[i] = round(L_add(L_temp1,L_tempr)); + + // data[j+1] = data[i+1] - tempi + L_temp1 = L_shr(L_deposit_h(data[i+1]),1); + data[j+1] = round(L_sub(L_temp1,L_tempi)); + + // data[i+1] += tempi + data[i+1] = round(L_add(L_temp1,L_tempi)); + } + index = add(index,index_step); + wr = wr_array[index]; + if (isign < 0) + wi = negate(wi_array[index]); + else + wi = wi_array[index]; + } + mmax = istep; + } +} + + diff --git a/imbe_vocoder/src/lib/dsp_sub.h b/imbe_vocoder/src/lib/dsp_sub.h new file mode 100644 index 0000000..53590e6 --- /dev/null +++ b/imbe_vocoder/src/lib/dsp_sub.h @@ -0,0 +1,81 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + + +#ifndef _DSP_SUB +#define _DSP_SUB + + +#define CNST_0_5_Q1_15 0x4000 +#define CNST_0_5_Q5_11 0x0400 +#define CNST_1_0_Q1_15 0x7FFF + + +//----------------------------------------------------------------------------- +// PURPOSE: +// Perform inverse DCT +// +// +// INPUT: +// in - pointer to input data +// m_lim - input data's size +// i_lim - result's size +// out - pointer to save result +// +// OUTPUT: +// None +// +// RETURN: +// Saved in out result of conversion +// +//----------------------------------------------------------------------------- +void idct(Word16 *in, Word16 m_lim, Word16 i_lim, Word16 *out); + + +//----------------------------------------------------------------------------- +// PURPOSE: +// Perform DCT +// +// +// INPUT: +// in - pointer to input data +// m_lim - input data's size +// i_lim - result's size +// out - pointer to save result +// +// OUTPUT: +// None +// +// RETURN: +// Saved in out result of conversion +// +//----------------------------------------------------------------------------- +void dct(Word16 *in, Word16 m_lim, Word16 i_lim, Word16 *out); + +#define FFTLENGTH 256 + + +void fft_init(void); +void fft(Word16 *datam1, Word16 nn, Word16 isign); + +void c_fft(Word16 * farray_ptr); + +#endif diff --git a/imbe_vocoder/src/lib/encode.cc b/imbe_vocoder/src/lib/encode.cc new file mode 100644 index 0000000..fee100e --- /dev/null +++ b/imbe_vocoder/src/lib/encode.cc @@ -0,0 +1,97 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + + +#include "typedef.h" +#include "globals.h" +#include "imbe.h" +#include "basic_op.h" +#include "dsp_sub.h" +#include "aux_sub.h" +#include "tbls.h" +#include "encode.h" +#include "dc_rmv.h" +#include "pe_lpf.h" +#include "pitch_est.h" +#include "pitch_ref.h" +#include "v_uv_det.h" +#include "sa_encode.h" +#include "ch_encode.h" +#include "op25_imbe_vocoder.h" + + + + +void op25_imbe_vocoder::encode_init(void) +{ + v_zap(pitch_est_buf, PITCH_EST_BUF_SIZE); + v_zap(pitch_ref_buf, PITCH_EST_BUF_SIZE); + v_zap(pe_lpf_mem, PE_LPF_ORD); + pitch_est_init(); + fft_init(); + dc_rmv_mem = 0; +} + + +void op25_imbe_vocoder::encode(IMBE_PARAM *imbe_param, Word16 *frame_vector, Word16 *snd) +{ + Word16 i; + Word16 *wr_ptr, *sig_ptr; + + for(i = 0; i < PITCH_EST_BUF_SIZE - FRAME; i++) + { + pitch_est_buf[i] = pitch_est_buf[i + FRAME]; + pitch_ref_buf[i] = pitch_ref_buf[i + FRAME]; + } + + dc_rmv(snd, &pitch_ref_buf[PITCH_EST_BUF_SIZE - FRAME], &dc_rmv_mem, FRAME); + pe_lpf(&pitch_ref_buf[PITCH_EST_BUF_SIZE - FRAME], &pitch_est_buf[PITCH_EST_BUF_SIZE - FRAME], pe_lpf_mem, FRAME); + + pitch_est(imbe_param, pitch_est_buf); + + // + // Speech windowing and FFT calculation + // + wr_ptr = (Word16 *)wr; + sig_ptr = &pitch_ref_buf[40]; + for(i = 146; i < 256; i++) + { + fft_buf[i].re = mult(*sig_ptr++, *wr_ptr++); + fft_buf[i].im = 0; + } + fft_buf[0].re = *sig_ptr++; + fft_buf[0].im = 0; + wr_ptr--; + for(i = 1; i < 111; i++) + { + fft_buf[i].re = mult(*sig_ptr++, *wr_ptr--); + fft_buf[i].im = 0; + } + for(i = 111; i < 146; i++) + fft_buf[i].re = fft_buf[i].im = 0; + + fft((Word16 *)&fft_buf, FFTLENGTH, 1); + + pitch_ref(imbe_param, fft_buf); + v_uv_det(imbe_param, fft_buf); + sa_encode(imbe_param); + encode_frame_vector(imbe_param, frame_vector); +} diff --git a/imbe_vocoder/src/lib/encode.h b/imbe_vocoder/src/lib/encode.h new file mode 100644 index 0000000..7b06889 --- /dev/null +++ b/imbe_vocoder/src/lib/encode.h @@ -0,0 +1,32 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + + +#ifndef _ENCODE +#define _ENCODE + +#define PITCH_EST_BUF_SIZE 621 +#if 0 +void encode_init(void); +void encode(IMBE_PARAM *imbe_param, Word16 *frame_vector, Word16 *snd); +#endif + +#endif diff --git a/imbe_vocoder/src/lib/globals.h b/imbe_vocoder/src/lib/globals.h new file mode 100644 index 0000000..5474030 --- /dev/null +++ b/imbe_vocoder/src/lib/globals.h @@ -0,0 +1,62 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + + +#ifndef _GLOBALS +#define _GLOBALS + + +//#define PI (double)3.1415926535897932384626433832795 + +#define CNST_0_9254_Q0_16 60647 // 0.9254 in unsigned Q0.16 format +#define CNST_0_33_Q0_16 0x5556 // 0.(3) = 1/3 in unsigned Q0.16 format + + +#define CNST_ONE_Q8_24 0x01000000 +#define CNST_0_7_Q1_15 0x599A +#define CNST_0_4_Q1_15 0x3333 +#define CNST_0_03_Q1_15 0x03D7 +#define CNST_0_05_Q1_15 0x0666 + +#define CNST_1_125_Q8_8 0x0120 +#define CNST_0_5_Q8_8 0x0080 +#define CNST_0_125_Q8_8 0x0020 +#define CNST_0_25_Q8_8 0x0040 + +#define CNST_0_8717_Q1_15 0x6F94 +#define CNST_0_0031_Q1_15 0x0064 +#define CNST_0_48_Q4_12 0x07AE +#define CNST_1_00_Q4_12 0x1000 +#define CNST_0_85_Q4_12 0x0D9B +#define CNST_0_4_Q4_12 0x0666 +#define CNST_0_05_Q4_12 0x00CD +#define CNST_0_5882_Q1_15 0x4B4B +#define CNST_0_2857_Q1_15 0x2492 + + +#define HI_BYTE(a) ((a >> 8) & 0xFF) +#define LO_BYTE(a) (a & 0xFF); + + + + + +#endif diff --git a/imbe_vocoder/src/lib/imbe.h b/imbe_vocoder/src/lib/imbe.h new file mode 100644 index 0000000..4dc956f --- /dev/null +++ b/imbe_vocoder/src/lib/imbe.h @@ -0,0 +1,69 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + + +#ifndef _IMBE +#define _IMBE + +#include "typedef.h" + +#define FRAME 160 // Number samples in frame +#define NUM_HARMS_MAX 56 // Maximum number of harmonics +#define NUM_HARMS_MIN 9 // Minimum number of harmonics +#define NUM_BANDS_MAX 12 // Maximum number of bands +#define MAX_BLOCK_LEN 10 // Maximum length of block used during spectral amplitude encoding +#define NUM_PRED_RES_BLKS 6 // Number of Prediction Residual Blocks +#define PE_LPF_ORD 21 // Order of Pitch estimation LPF +#define PITCH_EST_FRAME 301 // Pitch estimation frame size + + +#define B_NUM (NUM_HARMS_MAX - 1) + + +typedef struct +{ + Word16 e_p; + Word16 pitch; // Q14.2 + Word16 ref_pitch; // Q8.8 + Word32 fund_freq; + Word16 num_harms; + Word16 num_bands; + Word16 v_uv_dsn[NUM_HARMS_MAX]; + Word16 b_vec[NUM_HARMS_MAX + 3]; + Word16 bit_alloc[B_NUM + 4]; + Word16 sa[NUM_HARMS_MAX]; + Word16 l_uv; + Word16 div_one_by_num_harm; + Word16 div_one_by_num_harm_sh; +} IMBE_PARAM; + +typedef struct +{ + Word16 re; + Word16 im; +} Cmplx16; + +#if 0 +void decode_init(void); +void decode(IMBE_PARAM *imbe_param, Word16 *frame_vector, Word16 *snd); +#endif + +#endif diff --git a/imbe_vocoder/src/lib/math_sub.cc b/imbe_vocoder/src/lib/math_sub.cc new file mode 100644 index 0000000..6bbc2f8 --- /dev/null +++ b/imbe_vocoder/src/lib/math_sub.cc @@ -0,0 +1,355 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + +#include "typedef.h" +#include "basic_op.h" +#include "math_sub.h" + +//----------------------------------------------------------------------------- +// Table for routine Pow2() table[] = 2^(-1...0) +//----------------------------------------------------------------------------- +static const Word16 pow2_table[33] = +{ + 16384, 16743, 17109, 17484, 17867, 18258, 18658, 19066, 19484, 19911, + 20347, 20792, 21247, 21713, 22188, 22674, 23170, 23678, 24196, 24726, + 25268, 25821, 26386, 26964, 27554, 28158, 28774, 29405, 30048, 30706, + 31379, 32066, 32767 +}; + +//----------------------------------------------------------------------------- +// PURPOSE: +// Computes pow(2.0, x) +// +// INPUT: +// x - In signed Q10.22 format +// +// OUTPUT: +// None +// +// RETURN: +// Result in signed Q14.2 format +// +//----------------------------------------------------------------------------- +Word16 Pow2(Word32 x) +{ + Word16 exp, i, a, tmp; + Word32 L_x; + Word16 exponent, fraction; + + exponent = extract_h(L_shr(x, 6)); + if(exponent < 0) + exponent = add(exponent, 1); + fraction = extract_l(L_shr(L_sub(x, L_shl(L_deposit_l(exponent),6 + 16)), 7)); + + if(x < 0) + fraction = negate(fraction); + + L_x = L_mult(fraction, 32); // L_x = fraction<<6 + i = extract_h(L_x); // Extract b10-b16 of fraction + L_x = L_shr(L_x, 1); + a = extract_l(L_x); // Extract b0-b9 of fraction + a = a & (Word16)0x7fff; + + L_x = L_deposit_h (pow2_table[i]); // table[i] << 16 + tmp = sub(pow2_table[i], pow2_table[i + 1]); // table[i] - table[i+1] + L_x = L_msu(L_x, tmp, a); // L_x -= tmp*a*2 + + if(x < 0) + { + L_x = L_deposit_h(div_s(0x4000, extract_h(L_x))); // calculate 1/fraction + exponent = sub(exponent, 1); + } + + exp = sub(12, exponent); + L_x = L_shr_r(L_x, exp); + + return extract_h(L_x); +} + +//----------------------------------------------------------------------------- +// PURPOSE: +// Multiply a 32 bit number (L_var2) and a 16 bit +// number (var1) returning a 32 bit result. L_var2 +// is truncated to 31 bits prior to executing the +// multiply. +// +// INPUT: +// L_var2 - A Word32 input variable +// var1 - A Word16 input variable +// +// OUTPUT: +// None +// +// RETURN: +// A Word32 value +// +//----------------------------------------------------------------------------- +Word32 L_mpy_ls(Word32 L_var2, Word16 var1) +{ + Word32 L_varOut; + Word16 swtemp; + + swtemp = shr(extract_l(L_var2), 1); + swtemp = (Word16)32767 & (Word16) swtemp; + + L_varOut = L_mult(var1, swtemp); + L_varOut = L_shr(L_varOut, 15); + L_varOut = L_mac(L_varOut, var1, extract_h(L_var2)); + return (L_varOut); +} + +//----------------------------------------------------------------------------- +// Table for routine cos_fxp() +//----------------------------------------------------------------------------- +static const Word16 cos_table[129] = +{ + 32767, 32766, 32758, 32746, 32729, 32706, 32679, 32647, 32610, + 32568, 32522, 32470, 32413, 32352, 32286, 32214, 32138, 32058, + 31972, 31881, 31786, 31686, 31581, 31471, 31357, 31238, 31114, + 30986, 30853, 30715, 30572, 30425, 30274, 30118, 29957, 29792, + 29622, 29448, 29269, 29086, 28899, 28707, 28511, 28311, 28106, + 27897, 27684, 27467, 27246, 27020, 26791, 26557, 26320, 26078, + 25833, 25583, 25330, 25073, 24812, 24548, 24279, 24008, 23732, + 23453, 23170, 22884, 22595, 22302, 22006, 21706, 21403, 21097, + 20788, 20475, 20160, 19841, 19520, 19195, 18868, 18538, 18205, + 17869, 17531, 17190, 16846, 16500, 16151, 15800, 15447, 15091, + 14733, 14373, 14010, 13646, 13279, 12910, 12540, 12167, 11793, + 11417, 11039, 10660, 10279, 9896, 9512, 9127, 8740, 8351, + 7962, 7571, 7180, 6787, 6393, 5998, 5602, 5205, 4808, + 4410, 4011, 3612, 3212, 2811, 2411, 2009, 1608, 1206, + 804, 402, 0 +}; + +//----------------------------------------------------------------------------- +// PURPOSE: +// Computes the cosine of x whose value is expressed in radians/PI. +// +// INPUT: +// x - argument in Q1.15 +// +// OUTPUT: +// None +// +// RETURN: +// Result in Q1.15 +// +//----------------------------------------------------------------------------- +Word16 cos_fxp(Word16 x) +{ + Word16 tx, ty; + Word16 sign; + Word16 index1,index2; + Word16 m; + Word16 temp; + + sign = 0; + if(x < 0) + tx = negate(x); + else + tx = x; + + // if angle > pi/2, cos(angle) = -cos(pi-angle) + if(tx > X05_Q15) + { + tx = sub(ONE_Q15,tx); + sign = -1; + } + // convert input to be within range 0-128 + index1 = shr(tx,7); + index2 = add(index1,1); + + if (index1 == 128) + return (Word16)0; + + m = sub(tx,shl(index1,7)); + // convert decimal part to Q15 + m = shl(m,8); + + temp = sub(cos_table[index2],cos_table[index1]); + temp = mult(m,temp); + ty = add(cos_table[index1],temp); + + if(sign) + return negate(ty); + else + return ty; +} + +//----------------------------------------------------------------------------- +// PURPOSE: +// Computes the sinus of x whose value is expressed in radians/PI. +// +// INPUT: +// x - argument in Q1.15 +// +// OUTPUT: +// None +// +// RETURN: +// Result in Q1.15 +// +//----------------------------------------------------------------------------- +Word16 sin_fxp(Word16 x) +{ + Word16 tx, ty; + Word16 sign; + + sign = 0; + if(x < 0) + { + tx = negate(x); + sign = 1; + } + else + tx = x; + + if(tx > X05_Q15) + tx = sub(tx, X05_Q15); + else + tx = sub(X05_Q15,tx); + + ty = cos_fxp(tx); + + if(sign) + return negate(ty); + else + return ty; +} + + +//----------------------------------------------------------------------------- +// Table for routine sqrt_l_exp() +// table[] = sqrt((i+16)*2^-6) * 2^15, i.e. sqrt(x) scaled Q15 +//----------------------------------------------------------------------------- +static const Word16 sqrt_table[49] = +{ + 16384, 16888, 17378, 17854, 18318, 18770, 19212, 19644, 20066, 20480, + 20886, 21283, 21674, 22058, 22435, 22806, 23170, 23530, 23884, 24232, + 24576, 24915, 25249, 25580, 25905, 26227, 26545, 26859, 27170, 27477, + 27780, 28081, 28378, 28672, 28963, 29251, 29537, 29819, 30099, 30377, + 30652, 30924, 31194, 31462, 31727, 31991, 32252, 32511, 32767 +}; + +//----------------------------------------------------------------------------- +// PURPOSE: +// Computes sqrt(L_x), where L_x is positive. +// +// INPUT: +// L_x - argument in Q1.31 +// *exp - pointer to save denormalization exponent +// OUTPUT: +// Right shift to be applied to result, Q16.0 +// +// RETURN: +// Result in Q1.31 +// Right shift should be applied to it! +// +//----------------------------------------------------------------------------- +Word32 sqrt_l_exp(Word32 L_x, Word16 *exp) +{ + Word16 e, i, a, tmp; + Word32 L_y; + + if(L_x <= (Word32)0) + { + *exp = 0; + return (Word32)0; + } + + e = norm_l(L_x) & 0xFFFE; // get next lower EVEN norm. exp + L_x = L_shl(L_x, e); // L_x is normalized to [0.25..1) + *exp = e >> 1; // return 2*exponent (or Q1) + + L_x = L_shr(L_x, 9); + i = extract_h(L_x); // Extract b25-b31, 16 <= i <= 63 because of normalization + L_x = L_shr(L_x, 1); + a = extract_l(L_x); // Extract b10-b24 + a = a & (Word16)0x7fff; + + i = sub(i, 16); // 0 <= i <= 47 + + L_y = L_deposit_h(sqrt_table[i]); // table[i] << 16 + tmp = sub(sqrt_table[i], sqrt_table[i + 1]); // table[i] - table[i+1]) + L_y = L_msu(L_y, tmp, a); // L_y -= tmp*a*2 + + return L_y; +} + +//----------------------------------------------------------------------------- +// Table for routine Log2() +//----------------------------------------------------------------------------- +static const Word16 log_table[33] = +{ + 0, 1455, 2866, 4236, 5568, 6863, 8124, 9352, 10549, 11716, + 12855, 13967, 15054, 16117, 17156, 18172, 19167, 20142, 21097, 22033, + 22951, 23852, 24735, 25603, 26455, 27291, 28113, 28922, 29716, 30497, + 31266, 32023, 32767 +}; + +//----------------------------------------------------------------------------- +// PURPOSE: +// Computes log2 of x +// +// INPUT: +// x - argument in Q14.2 +// +// OUTPUT: +// None +// +// RETURN: +// Result in Q10.22 +// +//----------------------------------------------------------------------------- +Word32 Log2(Word16 x) +{ + Word16 exp, i, a, tmp; + Word32 L_y; + + if(x <= (Word16)0) + return 0; + + exp = norm_s(x); + x = shl(x, exp); + + i = shr(x, 9); // Extract b15-b9 + a = shl(x & 0x1FF, 6); // Extract b8-b0 + i = sub (i, 32); + + L_y = L_deposit_h(log_table[i]); // table[i] << 16 + tmp = sub(log_table[i], log_table[i + 1]); // table[i] - table[i+1] + L_y = L_msu(L_y, tmp, a); // L_y -= tmp*a*2 + + L_y = L_shr(L_y, 9); + + exp = sub(12, exp); + L_y = L_add(L_y, L_deposit_h(shl(exp, 6))); + + return L_y; +} + + + + + + + + + diff --git a/imbe_vocoder/src/lib/math_sub.h b/imbe_vocoder/src/lib/math_sub.h new file mode 100644 index 0000000..baf75fe --- /dev/null +++ b/imbe_vocoder/src/lib/math_sub.h @@ -0,0 +1,130 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + + +#ifndef _MATH_SUB +#define _MATH_SUB + +#define X05_Q15 16384 // (0.5*(1<<15)) +#define ONE_Q15 32767 // ((1<<15)-1) + +//----------------------------------------------------------------------------- +// PURPOSE: +// Computes the cosine of x whose value is expressed in radians/PI. +// +// INPUT: +// x - argument in Q1.15 +// +// OUTPUT: +// None +// +// RETURN: +// Result in Q1.15 +// +//----------------------------------------------------------------------------- +Word16 cos_fxp(Word16 x); + +//----------------------------------------------------------------------------- +// PURPOSE: +// Computes the sinus of x whose value is expressed in radians/PI. +// +// INPUT: +// x - argument in Q1.15 +// +// OUTPUT: +// None +// +// RETURN: +// Result in Q1.15 +// +//----------------------------------------------------------------------------- +Word16 sin_fxp(Word16 x); + +//----------------------------------------------------------------------------- +// PURPOSE: +// Multiply a 32 bit number (L_var2) and a 16 bit +// number (var1) returning a 32 bit result. L_var2 +// is truncated to 31 bits prior to executing the +// multiply. +// +// INPUT: +// L_var2 - A Word32 input variable +// var1 - A Word16 input variable +// +// OUTPUT: +// None +// +// RETURN: +// A Word32 value +// +//----------------------------------------------------------------------------- +Word32 L_mpy_ls(Word32 L_var2, Word16 var1); + +//----------------------------------------------------------------------------- +// PURPOSE: +// Computes pow(2.0, x) +// +// INPUT: +// x - In signed Q10.22 format +// +// OUTPUT: +// None +// +// RETURN: +// Result in signed Q14.2 format +// +//----------------------------------------------------------------------------- +Word16 Pow2 (Word32 x); + +//----------------------------------------------------------------------------- +// PURPOSE: +// Computes sqrt(L_x), where L_x is positive. +// +// INPUT: +// L_x - argument in Q1.31 +// *exp - pointer to save denormalization exponent +// OUTPUT: +// Right shift to be applied to result, Q16.0 +// +// RETURN: +// Result in Q1.31 +// Right shift should be applied to it! +// +//----------------------------------------------------------------------------- +Word32 sqrt_l_exp (Word32 L_x, Word16 *exp); + +//----------------------------------------------------------------------------- +// PURPOSE: +// Computes log2 of x +// +// INPUT: +// x - argument in Q14.2 +// +// OUTPUT: +// None +// +// RETURN: +// Result in Q10.22 +// +//----------------------------------------------------------------------------- +Word32 Log2(Word16 x); + +#endif diff --git a/imbe_vocoder/src/lib/op25_imbe.i b/imbe_vocoder/src/lib/op25_imbe.i new file mode 100644 index 0000000..997d688 --- /dev/null +++ b/imbe_vocoder/src/lib/op25_imbe.i @@ -0,0 +1,41 @@ +/* -*- c++ -*- */ + +%feature("autodoc", "1"); // generate python docstrings + +%include "exception.i" +%import "gnuradio.i" // the common stuff + +%{ +#include "gnuradio_swig_bug_workaround.h" // mandatory bug fix + +#include "typedef.h" +#include "globals.h" +#include "imbe.h" +#include "dsp_sub.h" +#include "basic_op.h" +#include "math_sub.h" +#include "encode.h" +#include "decode.h" +#include "op25_imbe_vocoder.h" + +#include +%} + +// ---------------------------------------------------------------- + +/* + * First arg is the package prefix. + * Second arg is the name of the class minus the prefix. + * + * This does some behind-the-scenes magic so we can + * access op25_imbe_vocoder from python as op25_imbe.vocoder + */ +GR_SWIG_BLOCK_MAGIC(op25_imbe,vocoder); + +op25_imbe_vocoder_sptr op25_imbe_make_vocoder (bool encode_flag, bool verbose_flag, int stretch_amt, char* udp_host, int udp_port, bool raw_vectors_flag); + +class op25_imbe_vocoder : public gr_block +{ +private: + op25_imbe_vocoder (bool encode_flag, bool verbose_flag, int stretch_amt, char* udp_host, int udp_port, bool raw_vectors_flag); +}; diff --git a/imbe_vocoder/src/lib/op25_imbe_vocoder.cc b/imbe_vocoder/src/lib/op25_imbe_vocoder.cc new file mode 100644 index 0000000..360f22f --- /dev/null +++ b/imbe_vocoder/src/lib/op25_imbe_vocoder.cc @@ -0,0 +1,376 @@ +/* -*- c++ -*- */ +/* + * GNU Radio interface for Pavel Yazev's Project 25 IMBE Encoder/Decoder + * + * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2009 Pavel Yazev E-mail: pyazev@gmail.com + * Copyright 2009 KA1RBI + * + * This 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, or (at your option) + * any later version. + * + * It is distributed in the hope that 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 it; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * config.h is generated by configure. It contains the results + * of probing for features, options etc. It should be the first + * file included in your .cc file. + */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +#include "typedef.h" +#include "globals.h" +#include "imbe.h" +#include "dsp_sub.h" +#include "basic_op.h" +#include "math_sub.h" +#include "encode.h" +#include "decode.h" + +#include +#include +#include +#include + +/* + * Create a new instance of op25_imbe_vocoder and return + * a boost shared_ptr. This is effectively the public constructor. + */ +op25_imbe_vocoder_sptr +op25_imbe_make_vocoder (bool encode_flag, bool verbose_flag, int stretch_amt, char* udp_host, int udp_port, bool raw_vectors_flag) +{ + return op25_imbe_vocoder_sptr (new op25_imbe_vocoder (encode_flag, verbose_flag, stretch_amt, udp_host, udp_port, raw_vectors_flag)); +} + +/* + * Specify constraints on number of input and output streams. + * This info is used to construct the input and output signatures + * (2nd & 3rd args to gr_block's constructor). The input and + * output signatures are used by the runtime system to + * check that a valid number and type of inputs and outputs + * are connected to this block. In this case, we accept + * only 1 input and 1 output. + */ +static const int MIN_IN = 1; // mininum number of input streams +static const int MAX_IN = 1; // maximum number of input streams +static const int MIN_OUT = 1; // minimum number of output streams +static const int MAX_OUT = 1; // maximum number of output streams + +/* + * The private constructor + */ +op25_imbe_vocoder::op25_imbe_vocoder (bool encode_flag, bool verbose_flag, int stretch_amt, char* udp_host, int udp_port, bool raw_vectors_flag) + : gr_block ("vocoder", + gr_make_io_signature (MIN_IN, MAX_IN, sizeof (short)), + gr_make_io_signature ((udp_port == 0) ? 1 : 0, (udp_port == 0) ? 1 : 0, (udp_port == 0) ? sizeof(uint8_t) : 0)), + frame_cnt(0), + write_sock(0), + write_bufp(0), + peak_amplitude(0), + peak(0), + samp_ct(0), + rxbufp(0), + codeword_ct(0), + sampbuf_ct(0), + stretch_count(0), + save_l(0), + f_body(P25_VOICE_FRAME_SIZE), + prev_prev_e_p(0), + seed(1), + num_harms_prev1(0), + num_harms_prev2(0), + num_harms_prev3(0), + fund_freq_prev(0), + th_max(0), + dc_rmv_mem(0) +{ + memset(wr_array, 0, sizeof(wr_array)); + memset(wi_array, 0, sizeof(wi_array)); + memset(pitch_est_buf, 0, sizeof(pitch_est_buf)); + memset(pitch_ref_buf, 0, sizeof(pitch_ref_buf)); + memset(pe_lpf_mem, 0, sizeof(pe_lpf_mem)); + memset(fft_buf, 0, sizeof(fft_buf)); + memset(write_buf, 0, sizeof(write_buf)); + memset(rxbuf, 0, sizeof(rxbuf)); + memset(sampbuf, 0, sizeof(sampbuf)); + memset(sa_prev1, 0, sizeof(sa_prev1)); + memset(sa_prev2, 0, sizeof(sa_prev2)); + memset(uv_mem, 0, sizeof(uv_mem)); + memset(ph_mem, 0, sizeof(ph_mem)); + memset(vu_dsn_prev, 0, sizeof(vu_dsn_prev)); + memset(sa_prev3, 0, sizeof(sa_prev3)); + memset(v_uv_dsn, 0, sizeof(v_uv_dsn)); + memset(&my_imbe_param, 0, sizeof(IMBE_PARAM)); + + fprintf(stderr,"Project 25 IMBE Encoder/Decoder Fixed-Point implementation\n"); + fprintf(stderr,"Developed by Pavel Yazev E-mail: pyazev@gmail.com\n"); + fprintf(stderr,"Version 1.0 (c) Copyright 2009\n"); + fprintf(stderr,"This program comes with ABSOLUTELY NO WARRANTY.\n"); + fprintf(stderr,"This is free software, and you are welcome to redistribute it\n"); + fprintf(stderr,"under certain conditions; see the file ``LICENSE'' for details.\n"); + + decode_init(); + encode_init(); + + opt_encode_flag = encode_flag; + opt_dump_raw_vectors = raw_vectors_flag; + opt_verbose = verbose_flag; + opt_udp_port = udp_port; + + opt_stretch_amt = 0; + if (stretch_amt < 0) { + opt_stretch_sign = -1; + opt_stretch_amt = 0 - stretch_amt; + } else { + opt_stretch_sign = 1; + opt_stretch_amt = stretch_amt; + } + + if (opt_udp_port == 0) + // local output to gr source + set_output_multiple(P25_VOICE_FRAME_SIZE >> 1); + else + // remote UDP output + init_sock(udp_host, opt_udp_port); +} + +/* + * Our virtual destructor. + */ +op25_imbe_vocoder::~op25_imbe_vocoder () +{ +} + +static const int STATS_INTERVAL = 20; +static const int SAMP_INTERVAL = 8192; + +void op25_imbe_vocoder::append_imbe_codeword(bit_vector& frame_body, Word16 frame_vector[], unsigned int& codeword_ct) +{ + voice_codeword cw(voice_codeword_sz); + uint8_t obuf[P25_VOICE_FRAME_SIZE/2]; + // construct 144-bit codeword from 88 bits of parameters + imbe_header_encode(cw, frame_vector[0], frame_vector[1], frame_vector[2], frame_vector[3], frame_vector[4], frame_vector[5], frame_vector[6], frame_vector[7]); + + // add codeword to voice data unit + imbe_interleave(frame_body, cw, codeword_ct); + + // after the ninth and final codeword added, dispose of frame + if (++codeword_ct >= nof_voice_codewords) { + static const uint64_t hws[2] = { 0x293555ef2c653437LL, 0x293aba93bec26a2bLL }; + p25_setup_frame_header(frame_body, hws[frame_cnt & 1]); + for (size_t i = 0; i < sizeof(imbe_ldu_ls_data_bits) / sizeof(imbe_ldu_ls_data_bits[0]); i++) { + frame_body[imbe_ldu_ls_data_bits[i]] = 0; + } + // finally, output the frame + if (opt_udp_port > 0) { + // pack the bits into bytes, MSB first + size_t obuf_ct = 0; + for (uint32_t i = 0; i < P25_VOICE_FRAME_SIZE; i += 8) { + uint8_t b = + (frame_body[i+0] << 7) + + (frame_body[i+1] << 6) + + (frame_body[i+2] << 5) + + (frame_body[i+3] << 4) + + (frame_body[i+4] << 3) + + (frame_body[i+5] << 2) + + (frame_body[i+6] << 1) + + (frame_body[i+7] ); + obuf[obuf_ct++] = b; + } + sendto(write_sock, obuf, obuf_ct, 0, (struct sockaddr*)&write_sock_addr, sizeof(write_sock_addr)); + } else { + for (uint32_t i = 0; i < P25_VOICE_FRAME_SIZE; i += 2) { + uint8_t dibit = + (frame_body[i+0] << 1) + + (frame_body[i+1] ); + output_queue.push_back(dibit); + } + } + codeword_ct = 0; + frame_cnt++; + if (opt_verbose && (frame_cnt % STATS_INTERVAL) == 0) { + gettimeofday(&tv, &tz); + int s = tv.tv_sec - oldtv.tv_sec; + int us = tv.tv_usec - oldtv.tv_usec; + if (us < 0) { + us = us + 1000000; + s = s - 1; + } + float f = us; + f /= 1000000; + f += s; + fprintf (stderr, "time %f peak %5d\n", f / STATS_INTERVAL, peak_amplitude); + oldtv = tv; + } + } +} + +void op25_imbe_vocoder::rxchar(char c) +{ + Word16 snd[FRAME]; + Word16 frame_vector[8]; + int u[8]; + + if (c < ' ') { + if (c == '\n') { + rxbuf[rxbufp] = 0; + sscanf(rxbuf, "%x %x %x %x %x %x %x %x", &u[0], &u[1], &u[2], &u[3], &u[4], &u[5], &u[6], &u[7]); + for (int i=0; i < 8; i++) { + frame_vector[i] = u[i]; + } + // decode 88 bits, outputs 160 sound samples (8000 rate) + decode(&my_imbe_param, frame_vector, snd); + // FIXME - output data to GR source + fwrite(snd, sizeof(short), FRAME, stdout); + fflush(stdout); + rxbufp = 0; + } + return; + } + rxbuf[rxbufp++] = c; + if (rxbufp >= RXBUF_MAX) { + rxbufp = RXBUF_MAX - 1; + } +} + +void op25_imbe_vocoder::compress_frame(Word16 snd[]) +{ + Word16 frame_vector[8]; + + // encode 160 audio samples into 88 bits (u0-u7) + encode(&my_imbe_param, frame_vector, (Word16*) snd); + + // if dump option, dump u0-u7 to output + if (opt_dump_raw_vectors) { + char s[128]; + sprintf(s, "%03x %03x %03x %03x %03x %03x %03x %03x\n", frame_vector[0], frame_vector[1], frame_vector[2], frame_vector[3], frame_vector[4], frame_vector[5], frame_vector[6], frame_vector[7]); + memcpy(&write_buf[write_bufp], s, strlen(s)); + write_bufp += strlen(s); + if (write_bufp >= 288) { + sendto(write_sock, write_buf, 288, 0, (struct sockaddr*)&write_sock_addr, sizeof(write_sock_addr)); + write_bufp = 0; + } + return; + } + append_imbe_codeword(f_body, frame_vector, codeword_ct); +} + +void op25_imbe_vocoder::add_sample(Word16 samp) +{ + // add one sample to 160-sample frame buffer and process if filled + sampbuf[sampbuf_ct++] = samp; + if (sampbuf_ct >= FRAME) { + compress_frame(sampbuf); + sampbuf_ct = 0; + } + + // track signal amplitudes + Word16 asamp = (samp < 0) ? 0 - samp : samp; + peak = (asamp > peak) ? asamp : peak; + if (++samp_ct >= SAMP_INTERVAL) { + peak_amplitude = peak; + peak = 0; + samp_ct = 0; + } +} + +void op25_imbe_vocoder::compress_samp(Word16 samp) +{ + // Apply sample rate slew to accomodate sound card rate discrepancy - + // workaround for USRP underrun problem occurring when sound card + // capture rate is slower than the correct rate + + // FIXME: autodetect proper value for opt_stretch_amt + // perhaps by steering the LDU output rate to a 180.0 msec. rate + + stretch_count++; + if (opt_stretch_amt != 0 && stretch_count >= opt_stretch_amt) { + stretch_count = 0; + if (opt_stretch_sign < 0) + // spill this samp + return; + // repeat this samp + add_sample(samp); + } + add_sample(samp); +} + +void op25_imbe_vocoder::init_sock(char* udp_host, int udp_port) +{ + memset (&write_sock_addr, 0, sizeof(write_sock_addr)); + write_sock = socket(PF_INET, SOCK_DGRAM, 17); // UDP socket + if (write_sock < 0) { + fprintf(stderr, "op25_imbe_vocoder: socket: %d\n", errno); + write_sock = 0; + return; + } + if (!inet_aton(udp_host, &write_sock_addr.sin_addr)) { + fprintf(stderr, "op25_imbe_vocoder: bad IP address\n"); + close(write_sock); + write_sock = 0; + return; + } + write_sock_addr.sin_family = AF_INET; + write_sock_addr.sin_port = htons(udp_port); +} + +void +op25_imbe_vocoder::forecast(int nof_output_items, gr_vector_int &nof_input_items_reqd) +{ + /* This block consumes 8000 symbols/s and produces 4800 + * samples/s. That's a sampling rate of 5/3 or 1.66667. + */ + const size_t nof_inputs = nof_input_items_reqd.size(); + const int nof_samples_reqd = 1.66667 * nof_output_items; + std::fill(&nof_input_items_reqd[0], &nof_input_items_reqd[nof_inputs], nof_samples_reqd); +} + +int +op25_imbe_vocoder::general_work (int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const short *in = (const short *) input_items[0]; + + for (int i = 0; i < ninput_items[0]; i++){ + compress_samp(in[i]); + } + + // Tell runtime system how many input items we consumed on + // each input stream. + + consume_each (ninput_items[0]); + + if (opt_udp_port > 0) // in udp option, we are a gr sink only + return 0; + + uint8_t *out = reinterpret_cast(output_items[0]); + const int n = std::min(static_cast(output_queue.size()), noutput_items); + if(0 < n) { + copy(output_queue.begin(), output_queue.begin() + n, out); + output_queue.erase(output_queue.begin(), output_queue.begin() + n); + } + // Tell runtime system how many output items we produced. + return n; +} diff --git a/imbe_vocoder/src/lib/op25_imbe_vocoder.h b/imbe_vocoder/src/lib/op25_imbe_vocoder.h new file mode 100644 index 0000000..3b9ce7a --- /dev/null +++ b/imbe_vocoder/src/lib/op25_imbe_vocoder.h @@ -0,0 +1,175 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifndef INCLUDED_OP25_IMBE_VOCODER_H +#define INCLUDED_OP25_IMBE_VOCODER_H + +#include +#include +#include +#include +#include +#include +typedef std::vector bit_vector; + +class op25_imbe_vocoder; + +/* + * We use boost::shared_ptr's instead of raw pointers for all access + * to gr_blocks (and many other data structures). The shared_ptr gets + * us transparent reference counting, which greatly simplifies storage + * management issues. This is especially helpful in our hybrid + * C++ / Python system. + * + * See http://www.boost.org/libs/smart_ptr/smart_ptr.htm + * + * As a convention, the _sptr suffix indicates a boost::shared_ptr + */ +typedef boost::shared_ptr op25_imbe_vocoder_sptr; + +/*! + * \brief Return a shared_ptr to a new instance of op25_imbe_vocoder. + * + * To avoid accidental use of raw pointers, op25_imbe_vocoder's + * constructor is private. op25_imbe_make_vocoder is the public + * interface for creating new instances. + */ +op25_imbe_vocoder_sptr op25_imbe_make_vocoder (bool encode_flag, bool verbose_flag, int stretch_amt, char* udp_host, int udp_port, bool raw_vectors_flag); + +/*! + * \brief + * \ingroup block + * + */ +class op25_imbe_vocoder : public gr_block +{ +private: + // The friend declaration allows op25_imbe_make_vocoder to + // access the private constructor. + + friend op25_imbe_vocoder_sptr op25_imbe_make_vocoder (bool encode_flag, bool verbose_flag, int stretch_amt, char* udp_host, int udp_port, bool raw_vectors_flag); + + op25_imbe_vocoder (bool encode_flag, bool verbose_flag, int stretch_amt, char* udp_host, int udp_port, bool raw_vectors_flag); // private constructor + + public: + ~op25_imbe_vocoder (); // public destructor + + void forecast(int nof_output_items, gr_vector_int &nof_input_items_reqd); + + // Where all the action really happens + + int general_work (int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + + private: + static const int RXBUF_MAX = 80; + + /* data items */ + int frame_cnt ; + IMBE_PARAM my_imbe_param; + int write_sock; + struct sockaddr_in write_sock_addr; + int write_bufp; + char write_buf[512]; + struct timeval tv; + struct timezone tz; + struct timeval oldtv; + int peak_amplitude; + int peak; + int samp_ct; + char rxbuf[RXBUF_MAX]; + int rxbufp ; + unsigned int codeword_ct ; + Word16 sampbuf[FRAME]; + size_t sampbuf_ct ; + int stretch_count ; + uint8_t save_l; + bit_vector f_body; + + std::deque output_queue; + + bool opt_encode_flag; + bool opt_dump_raw_vectors; + bool opt_verbose; + int opt_stretch_amt; + int opt_stretch_sign; + int opt_udp_port; + + /* data items originally static (moved from individual c++ sources) */ + Word16 prev_pitch, prev_prev_pitch, prev_e_p, prev_prev_e_p; + UWord32 seed ; + Word16 num_harms_prev1; + Word32 sa_prev1[NUM_HARMS_MAX + 2]; + Word16 num_harms_prev2; + Word32 sa_prev2[NUM_HARMS_MAX + 2]; + Word16 uv_mem[105]; + UWord32 ph_mem[NUM_HARMS_MAX]; + Word16 num_harms_prev3; + Word32 fund_freq_prev; + Word16 vu_dsn_prev[NUM_HARMS_MAX]; + Word16 sa_prev3[NUM_HARMS_MAX]; + Word32 th_max; + Word16 v_uv_dsn[NUM_BANDS_MAX]; + Word16 wr_array[FFTLENGTH / 2 + 1]; + Word16 wi_array[FFTLENGTH / 2 + 1]; + Word16 pitch_est_buf[PITCH_EST_BUF_SIZE]; + Word16 pitch_ref_buf[PITCH_EST_BUF_SIZE]; + Word32 dc_rmv_mem; + Cmplx16 fft_buf[FFTLENGTH]; + Word16 pe_lpf_mem[PE_LPF_ORD]; + + /* member functions */ + void idct(Word16 *in, Word16 m_lim, Word16 i_lim, Word16 *out); + void dct(Word16 *in, Word16 m_lim, Word16 i_lim, Word16 *out); + void fft_init(void); + void fft(Word16 *datam1, Word16 nn, Word16 isign); + void encode(IMBE_PARAM *imbe_param, Word16 *frame_vector, Word16 *snd); + void parse(int argc, char **argv); + void pitch_est_init(void); + Word32 autocorr(Word16 *sigin, Word16 shift, Word16 scale_shift); + void e_p(Word16 *sigin, Word16 *res_buf); + void pitch_est(IMBE_PARAM *imbe_param, Word16 *frames_buf); + void sa_decode_init(void); + void sa_decode(IMBE_PARAM *imbe_param); + void sa_encode_init(void); + void sa_encode(IMBE_PARAM *imbe_param); + void uv_synt_init(void); + void uv_synt(IMBE_PARAM *imbe_param, Word16 *snd); + void v_synt_init(void); + void v_synt(IMBE_PARAM *imbe_param, Word16 *snd); + void pitch_ref_init(void); + Word16 voiced_sa_calc(Word32 num, Word16 den); + Word16 unvoiced_sa_calc(Word32 num, Word16 den); + void v_uv_det(IMBE_PARAM *imbe_param, Cmplx16 *fft_buf); + void append_imbe_codeword(bit_vector& frame_body, Word16 frame_vector[], unsigned int& codeword_ct); + void rxchar(char c); + void compress_frame(Word16 snd[]); + void add_sample(Word16 samp); + void compress_samp(Word16 samp); + void init_sock(char* udp_host, int udp_port); + void decode_init(void); + void decode(IMBE_PARAM *imbe_param, Word16 *frame_vector, Word16 *snd); + void encode_init(void); +}; + +#endif /* INCLUDED_OP25_IMBE_VOCODER_H */ diff --git a/imbe_vocoder/src/lib/pe_lpf.cc b/imbe_vocoder/src/lib/pe_lpf.cc new file mode 100644 index 0000000..b16547b --- /dev/null +++ b/imbe_vocoder/src/lib/pe_lpf.cc @@ -0,0 +1,74 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + +#include "typedef.h" +#include "globals.h" +#include "imbe.h" +#include "aux_sub.h" +#include "basic_op.h" +#include "math_sub.h" +#include "pe_lpf.h" + + + +static const Word16 lpf_coef[PE_LPF_ORD] = +{ + -94, -92, 185, 543, 288, -883, -1834, -495, 3891, 9141, 11512, + 9141, 3891, -495, -1834, -883, 288, 543, 185, -92, -94 +}; + + +//----------------------------------------------------------------------------- +// PURPOSE: +// Low-pass filter for pitch estimator +// +// +// INPUT: +// *sigin - pointer to input signal buffer +// *sigout - pointer to output signal buffer +// *mem - pointer to filter's memory element +// len - number of input signal samples +// +// OUTPUT: +// None +// +// RETURN: +// Saved filter state in mem +// +//----------------------------------------------------------------------------- +void pe_lpf(Word16 *sigin, Word16 *sigout, Word16 *mem, Word16 len) +{ + Word16 i; + Word32 L_sum; + + while(len--) + { + for(i = 0; i < PE_LPF_ORD - 1; i++) + mem[i] = mem[i + 1]; + mem[PE_LPF_ORD - 1] = *sigin++; + + L_sum = 0; + for(i = 0; i < PE_LPF_ORD; i++) + L_sum = L_mac(L_sum, mem[i], lpf_coef[i]); + + *sigout++ = round(L_sum); + } +} diff --git a/imbe_vocoder/src/lib/pe_lpf.h b/imbe_vocoder/src/lib/pe_lpf.h new file mode 100644 index 0000000..54fd017 --- /dev/null +++ b/imbe_vocoder/src/lib/pe_lpf.h @@ -0,0 +1,47 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + +#ifndef _PE_LPF +#define _PE_LPF + + +//----------------------------------------------------------------------------- +// PURPOSE: +// Low-pass filter for pitch estimator +// +// +// INPUT: +// *sigin - pointer to input signal buffer +// *sigout - pointer to output signal buffer +// *mem - pointer to filter's memory element +// len - number of input signal samples +// +// OUTPUT: +// None +// +// RETURN: +// Saved filter state in mem +// +//----------------------------------------------------------------------------- +void pe_lpf(Word16 *sigin, Word16 *sigout, Word16 *mem, Word16 len); + + +#endif diff --git a/imbe_vocoder/src/lib/pitch_est.cc b/imbe_vocoder/src/lib/pitch_est.cc new file mode 100644 index 0000000..812d7ac --- /dev/null +++ b/imbe_vocoder/src/lib/pitch_est.cc @@ -0,0 +1,353 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + + +#include "typedef.h" +#include "globals.h" +#include "imbe.h" +#include "basic_op.h" +#include "aux_sub.h" +#include "math_sub.h" +#include "tbls.h" +#include "pitch_est.h" +#include "encode.h" +#include "dsp_sub.h" +#include "op25_imbe_vocoder.h" + + + +static const Word16 min_max_tbl[203] = +{ + 0x0008, 0x0009, 0x000a, 0x000c, 0x000d, 0x000e, 0x000f, 0x0010, 0x0012, 0x0013, + 0x0014, 0x0115, 0x0216, 0x0218, 0x0319, 0x041a, 0x051b, 0x061c, 0x061e, 0x071f, + 0x0820, 0x0921, 0x0a22, 0x0a24, 0x0b25, 0x0c26, 0x0d27, 0x0e28, 0x0e2a, 0x0f2b, + 0x102c, 0x112d, 0x122e, 0x1230, 0x1331, 0x1432, 0x1533, 0x1634, 0x1636, 0x1737, + 0x1838, 0x1939, 0x1a3a, 0x1a3c, 0x1b3d, 0x1c3e, 0x1d3f, 0x1e40, 0x1e42, 0x1f43, + 0x2044, 0x2145, 0x2246, 0x2248, 0x2349, 0x244a, 0x254b, 0x264c, 0x264e, 0x274f, + 0x2850, 0x2951, 0x2a52, 0x2a54, 0x2b55, 0x2c56, 0x2d57, 0x2e58, 0x2e5a, 0x2f5b, + 0x305c, 0x315d, 0x325e, 0x3260, 0x3361, 0x3462, 0x3563, 0x3664, 0x3666, 0x3767, + 0x3868, 0x3969, 0x3a6a, 0x3a6c, 0x3b6d, 0x3c6e, 0x3d6f, 0x3e70, 0x3e72, 0x3f73, + 0x4074, 0x4175, 0x4276, 0x4278, 0x4379, 0x447a, 0x457b, 0x467c, 0x467e, 0x477f, + 0x4880, 0x4981, 0x4a82, 0x4a84, 0x4b85, 0x4c86, 0x4d87, 0x4e88, 0x4e8a, 0x4f8b, + 0x508c, 0x518d, 0x528e, 0x5290, 0x5391, 0x5492, 0x5593, 0x5694, 0x5696, 0x5797, + 0x5898, 0x5999, 0x5a9a, 0x5a9c, 0x5b9d, 0x5c9e, 0x5d9f, 0x5ea0, 0x5ea2, 0x5fa3, + 0x60a4, 0x61a5, 0x62a6, 0x62a8, 0x63a9, 0x64aa, 0x65ab, 0x66ac, 0x66ae, 0x67af, + 0x68b0, 0x69b1, 0x6ab2, 0x6ab4, 0x6bb5, 0x6cb6, 0x6db7, 0x6eb8, 0x6eba, 0x6fbb, + 0x70bc, 0x71bd, 0x72be, 0x72c0, 0x73c1, 0x74c2, 0x75c3, 0x76c4, 0x76c6, 0x77c7, + 0x78c8, 0x79c9, 0x7aca, 0x7aca, 0x7bca, 0x7cca, 0x7dca, 0x7eca, 0x7eca, 0x7fca, + 0x80ca, 0x81ca, 0x82ca, 0x82ca, 0x83ca, 0x84ca, 0x85ca, 0x86ca, 0x86ca, 0x87ca, + 0x88ca, 0x89ca, 0x8aca, 0x8aca, 0x8bca, 0x8cca, 0x8dca, 0x8eca, 0x8eca, 0x8fca, + 0x90ca, 0x91ca, 0x92ca, 0x92ca, 0x93ca, 0x94ca, 0x95ca, 0x96ca, 0x96ca, 0x97ca, + 0x98ca, 0x99ca, 0x9aca +}; + + + + + +void op25_imbe_vocoder::pitch_est_init(void) +{ + prev_pitch = prev_prev_pitch = 158; // 100 + prev_e_p = prev_prev_e_p = 0; +} + + + +Word32 op25_imbe_vocoder::autocorr(Word16 *sigin, Word16 shift, Word16 scale_shift) +{ + Word32 L_sum; + Word16 i; + + L_sum = 0; + for(i = 0; i < PITCH_EST_FRAME - shift; i++) + L_sum = L_add(L_sum, L_shr(L_mult(sigin[i], sigin[i + shift]), scale_shift) ); + + return L_sum; +} + + + +void op25_imbe_vocoder::e_p(Word16 *sigin, Word16 *res_buf) +{ + Word16 i, j, den_part_acc, tmp; + Word32 L_sum, L_num, L_den, L_e0, L_tmp; + Word16 sig_wndwed[PITCH_EST_FRAME]; + Word32 corr[259]; + Word16 index_beg, index_step; + Word16 scale_shift; + + + // Windowing input signal s * wi^2 + for(i = 0 ; i < PITCH_EST_FRAME; i++) + sig_wndwed[i] = mult_r(sigin[i], wi[i]); + + L_sum = 0; + for(i = 0 ; i < PITCH_EST_FRAME; i++) + L_sum = L_add(L_sum, L_mpy_ls( L_mult(sigin[i], sigin[i]), wi[i]) ); // sum(s^2 * wi^2) + + // Check for the overflow + if(L_sum == MAX_32) + { + // Recalculate with scaling + L_sum = 0; + for(i = 0 ; i < PITCH_EST_FRAME; i++) + L_sum = L_add(L_sum, L_mpy_ls( L_shr(L_mult(sigin[i], sigin[i]), 5), wi[i])); + scale_shift = 5; + } + else + scale_shift = 0; + + L_e0 = 0; + for(i = 0 ; i < PITCH_EST_FRAME; i++) + L_e0 = L_add(L_e0, L_shr( L_mult(sig_wndwed[i], sig_wndwed[i]), scale_shift)); // sum(s^2 * wi^4) + + // Calculate correlation for time shift in range 21...150 with step 0.5 + // For integer shifts + for(tmp = 21, i = 0; tmp <= 150; tmp++, i += 2) + corr[i] = autocorr(sig_wndwed, tmp, scale_shift); + // For intermediate shifts + for(i = 1; i < 258; i += 2) + corr[i] = L_shr( L_add(corr[i - 1], corr[i + 1]), 1); + + + // variable to calculate 1 - P * sum(wi ^4) in denominator + den_part_acc = CNST_0_8717_Q1_15; + + index_step = 42; // Note: 42 = 21 in Q15.1 format, so index_step will be used also as p in Q15.1 format + index_beg = 0; + L_e0 = L_shr(L_e0, 7); // divide by 64 to compensate wi scaling + // p = 21...122 by step 0.5 + for(i = 0; i < 203; i++) + { + + // Calculate sum( corr ( n * p) ) + L_tmp = 0; + j = index_beg; + while(j <= 258) + { + L_tmp = L_add(L_tmp, corr[j]); + j += index_step; + } + + L_tmp = L_shr(L_tmp, 6); // compensate wi scaling + L_tmp = L_add(L_tmp, L_e0); // For n = 0 + L_tmp = L_tmp * index_step; + L_num = L_sub(L_sum, L_tmp); + + index_beg++; + index_step++; + + L_den = L_mpy_ls(L_sum, den_part_acc); + + if(L_num < L_den && L_den != 0) + { + //res_buf[i] = (Word16)((double)L_num/(double)L_den * 4096.); // Q4.12 + + if(L_num <= 0) + res_buf[i] = 0; + else + { + tmp = norm_l(L_den); + tmp = div_s(extract_h(L_shl(L_num, tmp)), extract_h(L_shl(L_den, tmp))); + res_buf[i] = shr(tmp, 3); // convert to Q4.12 + } + } + else if(L_num >= L_den) + { + res_buf[i] = CNST_1_00_Q4_12; + //res_buf[i] = (Word16)((double)L_num/(double)L_den * 4096.); // Q4.12 + } + else + res_buf[i] = CNST_1_00_Q4_12; + + den_part_acc = sub(den_part_acc, CNST_0_0031_Q1_15); + } +} + + + + +void op25_imbe_vocoder::pitch_est(IMBE_PARAM *imbe_param, Word16 *frames_buf) +{ + Word16 e_p_arr0[203], e_p_arr1[203], e_p_arr2[203], e1p1_e2p2_est_save[203]; + Word16 min_index, max_index, p, i, p_index; + UWord16 tmp=0, p_fp; + UWord32 UL_tmp; + Word16 e_p_cur, pb, pf, ceb, s_tmp; + Word16 cef_est, cef, p0_est, p0, p1, p2, p1_max_index, p2_max_index, e1p1_e2p2_est, e1p1_e2p2; + + // Calculate E(p) function for current and two future frames + e_p(&frames_buf[0], e_p_arr0); + + // Look-Back Pitch Tracking + min_index = HI_BYTE(min_max_tbl[prev_pitch]); + max_index = LO_BYTE(min_max_tbl[prev_pitch]); + + p = pb = min_index; + e_p_cur = e_p_arr0[min_index]; + while(++p <= max_index) + if(e_p_arr0[p] < e_p_cur) + { + e_p_cur = e_p_arr0[p]; + pb = p; + } + ceb = add(e_p_cur, add(prev_e_p, prev_prev_e_p)); + + + if(ceb <= CNST_0_48_Q4_12) + { + prev_prev_pitch = prev_pitch; + prev_pitch = pb; + prev_prev_e_p = prev_e_p; + prev_e_p = e_p_arr0[pb]; + + imbe_param->pitch = pb + 42; // Result in Q15.1 format + imbe_param->e_p = prev_e_p; + return; + } + + + // Look-Ahead Pitch Tracking + e_p(&frames_buf[FRAME], e_p_arr1); + e_p(&frames_buf[2 * FRAME], e_p_arr2); + + p0_est = p0 = 0; + cef_est = e_p_arr0[p0] + e_p_arr1[p0] + e_p_arr2[p0]; + e1p1_e2p2 = 1; + + while(p0 < 203) + { + e1p1_e2p2_est = e_p_arr1[p0] + e_p_arr2[p0]; + + p1 = HI_BYTE(min_max_tbl[p0]); + p1_max_index = LO_BYTE(min_max_tbl[p0]); + + while(p1 <= p1_max_index) + { + p2 = HI_BYTE(min_max_tbl[p1]); + p2_max_index = LO_BYTE(min_max_tbl[p1]); + + s_tmp = sub(e1p1_e2p2_est, e_p_arr1[p1]); + + while(p2 <= p2_max_index) + { + //e1p1_e2p2 = add(e_p_arr1[p1], e_p_arr2[p2]); + //if(e1p1_e2p2 < e1p1_e2p2_est) + if(e_p_arr2[p2] < s_tmp) + { + //printf("p0 = %d p1 = %d p2 = %d %g\n", p0, p1, p2, (double)e1p1_e2p2/4096.); + e1p1_e2p2_est = add(e_p_arr1[p1], e_p_arr2[p2]);//e1p1_e2p2; + s_tmp = e_p_arr2[p2]; + } + p2++; + } + p1++; + } + + e1p1_e2p2_est_save[p0] = e1p1_e2p2_est; + + cef = add(e_p_arr0[p0], e1p1_e2p2_est); + if(cef < cef_est) + { + cef_est = cef; + p0_est = p0; + } + p0++; + } + + pf = p0_est; + // Sub-multiples analysis + if(pf >= 42) // Check if Sub-multiples are possible + { + if(pf < 84) + i = 1; + else if(pf < 126) + i = 2; + else if(pf < 168) + i = 3; + else + i = 4; + + p_fp = (pf + 42) << 8; // Convert pitch estimation from array index to unsigned Q7.19 format + + while(i--) + { + switch(i) + { + case 0: + tmp = p_fp >> 1; // P_est/2 + break; + + case 1: + UL_tmp = (UWord32)p_fp * 0x5555; // P_est/3 + tmp = UL_tmp >> 16; + break; + + case 2: + tmp = p_fp >> 2; // P_est/4 + break; + + case 3: + UL_tmp = (UWord32)p_fp * 0x3333; // P_est/5 + tmp = UL_tmp >> 16; + break; + } + + p_index = ((tmp + 0x0080) >> 8) - 42; // Convert fixed-point pitch value to integer array index with rounding + + cef = add(e_p_arr0[p_index], e1p1_e2p2_est_save[p_index]); + + if(cef <= CNST_0_85_Q4_12 && mult_r(cef, CNST_0_5882_Q1_15) <= cef_est) // 1/1.7 = 0.5882 + { + pf = p_index; + break; + } + + if(cef <= CNST_0_4_Q4_12 && mult_r(cef, CNST_0_2857_Q1_15) <= cef_est) // 1/3.5 = 0.2857 + { + pf = p_index; + break; + } + + if(cef <= CNST_0_05_Q4_12) + { + pf = p_index; + break; + } + } + } + + cef = add(e_p_arr0[pf], e1p1_e2p2_est_save[pf]); + + if(ceb <= cef) + p = pb; + else + p = pf; + + prev_prev_pitch = prev_pitch; + prev_pitch = p; + prev_prev_e_p = prev_e_p; + prev_e_p = e_p_arr0[p]; + + + imbe_param->pitch = p + 42; // Result in Q15.1 format + imbe_param->e_p = prev_e_p; +} diff --git a/imbe_vocoder/src/lib/pitch_est.h b/imbe_vocoder/src/lib/pitch_est.h new file mode 100644 index 0000000..b6b052d --- /dev/null +++ b/imbe_vocoder/src/lib/pitch_est.h @@ -0,0 +1,29 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + + +#ifndef _PITCH_EST +#define _PITCH_EST + +void pitch_est_init(void); +void pitch_est(IMBE_PARAM *imbe_param, Word16 *frames_buf); + +#endif diff --git a/imbe_vocoder/src/lib/pitch_ref.cc b/imbe_vocoder/src/lib/pitch_ref.cc new file mode 100644 index 0000000..035a06d --- /dev/null +++ b/imbe_vocoder/src/lib/pitch_ref.cc @@ -0,0 +1,167 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + + +#include "typedef.h" +#include "globals.h" +#include "imbe.h" +#include "basic_op.h" +#include "aux_sub.h" +#include "math_sub.h" +#include "dsp_sub.h" +#include "tbls.h" +#include "pitch_ref.h" + +#include +#include +#include + + +#define PITCH_REF_FRAME 221 +#define MIN_INDEX 50 + + + + +void pitch_ref(IMBE_PARAM *imbe_param, Cmplx16 *fft_buf) +{ + Word16 i, j, index_a_save, pitch_est, tmp, shift, index_wr, up_lim; + Cmplx16 sp_rec[FFTLENGTH/2]; + Word32 fund_freq, fund_freq_2, fund_freq_acc_a, fund_freq_acc_b, fund_freq_acc, L_tmp, amp_re_acc, amp_im_acc, L_sum, L_diff_min; + Word16 ha, hb, index_a, index_b, index_tbl[20], it_ind, re_tmp, im_tmp, pitch_cand=0; + Word32 fund_freq_cand=0; + + + pitch_est = shl(imbe_param->pitch, 7); // Convert to Q8.8 + pitch_est = sub(pitch_est, CNST_1_125_Q8_8); // Sub 1.125 = 9/8 + + L_diff_min = MAX_32; + for(i = 0; i < 19; i++) + { + shift = norm_s(pitch_est); + tmp = shl(pitch_est, shift); + tmp = div_s(0x4000, tmp); + fund_freq = L_shl(tmp, shift + 11); + + fund_freq_acc = fund_freq; + fund_freq_2 = L_shr(fund_freq, 1); + fund_freq_acc_a = L_sub(fund_freq, fund_freq_2); + fund_freq_acc_b = L_add(fund_freq, fund_freq_2); + + // Calculate upper limit for spectrum reconstruction + up_lim = extract_h(L_shr((UWord32)CNST_0_9254_Q0_16 * pitch_est, 1)); // 0.9254/fund_freq + up_lim = sub(up_lim, CNST_0_5_Q8_8); // sub 0.5 + up_lim = up_lim & 0xFF00; // extract fixed part + up_lim = mult(up_lim, extract_h(fund_freq)); + up_lim = shr(up_lim, 1); + + index_b = 0; + while(index_b <= up_lim) + { + ha = extract_h(fund_freq_acc_a); + hb = extract_h(fund_freq_acc_b); + index_a = (ha >> 8) + ((ha & 0xFF)?1:0); + index_b = (hb >> 8) + ((hb & 0xFF)?1:0); + + if(index_b >= MIN_INDEX) + { + L_tmp = L_shl(L_deposit_h(index_a), 8); + L_tmp = L_sub(L_tmp, fund_freq_acc); + L_tmp = L_add(L_tmp, 0x00020000); // for rounding purpose + L_tmp = L_shr(L_tmp, 2); + + index_a_save = index_a; + it_ind = 0; + + amp_re_acc = amp_im_acc = 0; + while(index_a < index_b) + { + index_wr = extract_h(L_tmp); + if(index_wr < 0 && (L_tmp & 0xFFFF)) // truncating for negative number + index_wr = add(index_wr, 1); + index_wr = add(index_wr, 160); + index_tbl[it_ind++] = index_wr; + if(index_wr >= 0 && index_wr <= 320) + { + amp_re_acc = L_mac(amp_re_acc, fft_buf[index_a].re, wr_sp[index_wr]); + amp_im_acc = L_mac(amp_im_acc, fft_buf[index_a].im, wr_sp[index_wr]); + } + + index_a++; + L_tmp = L_add(L_tmp, 0x400000); + } + + it_ind = 0; + index_a = index_a_save; + while(index_a < index_b) + { + index_wr = index_tbl[it_ind++]; + if(index_wr < 0 || index_wr > 320) + { + sp_rec[index_a].im = sp_rec[index_a].re = 0; + } + else + { + sp_rec[index_a].im = mult(mult(extract_h(amp_im_acc), wr_sp[index_wr]), 0x6666); + sp_rec[index_a].re = mult(mult(extract_h(amp_re_acc), wr_sp[index_wr]), 0x6666); + } + + index_a++; + } + } + + fund_freq_acc_a = L_add(fund_freq_acc_a, fund_freq); + fund_freq_acc_b = L_add(fund_freq_acc_b, fund_freq); + fund_freq_acc = L_add(fund_freq_acc, fund_freq); + } + + L_sum = 0; + for(j = MIN_INDEX; j <= up_lim; j++) + { + re_tmp = sub(fft_buf[j].re, sp_rec[j].re); + im_tmp = sub(fft_buf[j].im, sp_rec[j].im); + L_sum = L_mac(L_sum, re_tmp, re_tmp); + L_sum = L_mac(L_sum, im_tmp, im_tmp); + } + + if(L_sum < L_diff_min) + { + L_diff_min = L_sum; + pitch_cand = pitch_est; + fund_freq_cand = fund_freq; + } + + pitch_est = add(pitch_est, CNST_0_125_Q8_8); // Add 0.125 = 1/8 + } + + imbe_param->ref_pitch = pitch_cand; + imbe_param->fund_freq = fund_freq_cand; +} + + + + + + + + + + diff --git a/imbe_vocoder/src/lib/pitch_ref.h b/imbe_vocoder/src/lib/pitch_ref.h new file mode 100644 index 0000000..29ccf8a --- /dev/null +++ b/imbe_vocoder/src/lib/pitch_ref.h @@ -0,0 +1,28 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + + +#ifndef _PITCH_REF +#define _PIRCH_REF + +void pitch_ref(IMBE_PARAM *imbe_param, Cmplx16 *fft_buf); + +#endif diff --git a/imbe_vocoder/src/lib/qnt_sub.cc b/imbe_vocoder/src/lib/qnt_sub.cc new file mode 100644 index 0000000..bd0cbe8 --- /dev/null +++ b/imbe_vocoder/src/lib/qnt_sub.cc @@ -0,0 +1,144 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + + +#include "typedef.h" +#include "basic_op.h" +#include "qnt_sub.h" + + +//----------------------------------------------------------------------------- +// PURPOSE: +// Dequantize by quantizer step size +// +// +// INPUT: +// qval - quantized value +// step_size - step size used to quantize in unsigned Q0.16 format +// bit_num - the number of bits +// +// OUTPUT: +// None +// +// RETURN: +// Quantized Value in signed (bit_num).16 format +// +//----------------------------------------------------------------------------- +Word32 deqnt_by_step(Word16 qval, UWord16 step_size, Word16 bit_num) +{ + Word32 res; + + if(bit_num == 0) + return (Word32)0; + + res = (Word32)step_size * (qval - (1 << (bit_num - 1))); + res = L_add(res, ((Word32)step_size * CNST_0_5_Q0_16) >> 16); + + return res; +} + + + +//----------------------------------------------------------------------------- +// PURPOSE: +// Quantize by quantizer step size +// +// +// INPUT: +// val - value to be quantized in Q5.10 format +// step_size - step size used to quantize in unsigned Q0.16 format +// bit_num - the number of bits +// +// OUTPUT: +// None +// +// RETURN: +// Quantized Value in integer +// +//----------------------------------------------------------------------------- +Word16 qnt_by_step(Word16 val, UWord16 step_size, Word16 bit_num) +{ + Word16 index, min_val, max_val; + Word16 q_index, shift, tmp; + + shift = norm_s(step_size); + + tmp = div_s(0x4000, shl(step_size, shift)); // Remark: To get result in Qxx.16 format it is necessary left shift tmp by (shift + 3) + q_index = shr_r(mult(val, tmp), sub(9, shift)); // q_index here is rounded to the nearest integer + + max_val = 1 << (bit_num - 1); + min_val = negate(max_val); + + if(q_index < min_val) + index = 0; + else if(q_index >= max_val) + index = (1 << bit_num) - 1; + else + index = max_val + q_index; + + return index; +} + +//----------------------------------------------------------------------------- +// PURPOSE: +// Quantize by table +// +// +// INPUT: +// val - value to be quantized +// q_tbl - pointer to table +// q_tbl_size - size of table +// +// OUTPUT: +// None +// +// RETURN: +// Quantized Value in integer +// +//----------------------------------------------------------------------------- +Word16 tbl_quant(Word16 val, Word16 *q_tbl, Word16 q_tbl_size) +{ + Word16 min_index, max_index, index; + + min_index = 0; + max_index = q_tbl_size - 1; + + if(val >= q_tbl[max_index]) + return max_index; + + if(val <= q_tbl[min_index]) + return min_index; + + while(max_index - min_index != 1) + { + index = min_index + ((max_index - min_index) >> 1); + + if(q_tbl[index] > val) + max_index = index; + else + min_index = index; + } + + if(q_tbl[max_index] - val <= val - q_tbl[min_index]) + return max_index; + else + return min_index; +} diff --git a/imbe_vocoder/src/lib/qnt_sub.h b/imbe_vocoder/src/lib/qnt_sub.h new file mode 100644 index 0000000..ee3ac1c --- /dev/null +++ b/imbe_vocoder/src/lib/qnt_sub.h @@ -0,0 +1,86 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + +#ifndef _QNT_SUB +#define _QNT_SUB + + +#define CNST_0_5_Q0_16 0x8000 + + +//----------------------------------------------------------------------------- +// PURPOSE: +// Dequantize by quantizer step size +// +// +// INPUT: +// qval - quantized value +// step_size - step size used to quantize in unsigned Q0.16 format +// bit_num - the number of bits +// +// OUTPUT: +// None +// +// RETURN: +// Quantized Value in signed (bit_num).16 format +// +//----------------------------------------------------------------------------- +Word32 deqnt_by_step(Word16 qval, UWord16 step_size, Word16 bit_num); + +//----------------------------------------------------------------------------- +// PURPOSE: +// Quantize by quantizer step size +// +// +// INPUT: +// val - value to be quantized +// step_size - step size used to quantize in unsigned Q0.16 format +// bit_num - the number of bits +// +// OUTPUT: +// None +// +// RETURN: +// Quantized Value in integer +// +//----------------------------------------------------------------------------- +Word16 qnt_by_step(Word16 val, UWord16 step_size, Word16 bit_num); + +//----------------------------------------------------------------------------- +// PURPOSE: +// Quantize by table +// +// +// INPUT: +// val - value to be quantized +// q_tbl - pointer to table +// q_tbl_size - size of table +// +// OUTPUT: +// None +// +// RETURN: +// Quantized Value in integer +// +//----------------------------------------------------------------------------- +Word16 tbl_quant(Word16 val, Word16 *q_tbl, Word16 q_tbl_size); + +#endif diff --git a/imbe_vocoder/src/lib/rand_gen.cc b/imbe_vocoder/src/lib/rand_gen.cc new file mode 100644 index 0000000..b818d64 --- /dev/null +++ b/imbe_vocoder/src/lib/rand_gen.cc @@ -0,0 +1,61 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + + + +#include "typedef.h" +#include "basic_op.h" + +static UWord32 seed = 1; + + +//----------------------------------------------------------------------------- +// PURPOSE: +// Generate pseudo-random numbers in range -1...1 +// +// +// INPUT: +// None +// +// OUTPUT: +// None +// +// RETURN: +// Pseudo-random number in signed Q1.16 format +// +//----------------------------------------------------------------------------- +Word16 rand_gen(void) +{ + UWord32 hi, lo; + + lo = 16807 * (seed & 0xFFFF); + hi = 16807 * (seed >> 16); + + lo += (Word32)(hi & 0x7FFF) << 16; + lo += (hi >> 15); + + if(lo > 0x7FFFFFFF) + lo -= 0x7FFFFFFF; + + seed = lo; + + return (Word16)lo; +} diff --git a/imbe_vocoder/src/lib/rand_gen.h b/imbe_vocoder/src/lib/rand_gen.h new file mode 100644 index 0000000..f67d15e --- /dev/null +++ b/imbe_vocoder/src/lib/rand_gen.h @@ -0,0 +1,44 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + + +#ifndef _RAND_GEN +#define _RAND_GEN + + +//----------------------------------------------------------------------------- +// PURPOSE: +// Generate pseudo-random numbers in range -1...1 +// +// +// INPUT: +// None +// +// OUTPUT: +// None +// +// RETURN: +// Pseudo-random number in signed Q1.16 format +// +//----------------------------------------------------------------------------- +Word16 rand_gen(void); + +#endif diff --git a/imbe_vocoder/src/lib/sa_decode.cc b/imbe_vocoder/src/lib/sa_decode.cc new file mode 100644 index 0000000..b5d447c --- /dev/null +++ b/imbe_vocoder/src/lib/sa_decode.cc @@ -0,0 +1,200 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + + + +#include "typedef.h" +#include "globals.h" +#include "basic_op.h" +#include "imbe.h" +#include "tbls.h" +#include "qnt_sub.h" +#include "sa_decode.h" +#include "aux_sub.h" +#include "dsp_sub.h" +#include "math_sub.h" +#include "encode.h" +#include "op25_imbe_vocoder.h" + + + +//----------------------------------------------------------------------------- +// PURPOSE: +// Initialization of Spectral Amplitude Decoder +// +// +// INPUT: +// None +// +// OUTPUT: +// None +// +// RETURN: +// None +// +//----------------------------------------------------------------------------- +void op25_imbe_vocoder::sa_decode_init(void) +{ + num_harms_prev1 = 30; + v_zap((Word16 *)sa_prev1, 2 * (NUM_HARMS_MAX + 2)); +} + + +//----------------------------------------------------------------------------- +// PURPOSE: +// Perform Spectral Amplitude Decoding +// +// +// INPUT: +// IMBE_PARAM *imbe_param - pointer to IMBE_PARAM structure with +// valid num_harms and b_vec items +// +// OUTPUT: +// None +// +// RETURN: +// Decoded Spectral Amplitudes +// +//----------------------------------------------------------------------------- +void op25_imbe_vocoder::sa_decode(IMBE_PARAM *imbe_param) +{ + Word16 gain_vec[6], gain_r[6]; + UWord16 index, index_1, num_harms; + Word16 *gss_ptr, *ba_ptr, i, j, *t_vec_ptr, *b_vec_ptr; + Word16 t_vec[NUM_HARMS_MAX], c_vec[MAX_BLOCK_LEN]; + Word32 lmprbl_item; + Word16 bl_len, step_size, num_bits, tmp, ro_coef, si_coef, tmp1; + UWord32 k_coef, k_acc; + Word32 sum, tmp_word32, sa_tmp[NUM_HARMS_MAX]; + Word16 *sa; + + num_harms = imbe_param->num_harms; + index = num_harms - NUM_HARMS_MIN; + ba_ptr = imbe_param->bit_alloc; + b_vec_ptr = &imbe_param->b_vec[2]; + sa = imbe_param->sa; + + // Decoding the Gain Vector. gain_vec has signed Q5.11 format + gss_ptr = (Word16 *)&gain_step_size_tbl[index * 5]; + gain_vec[0] = gain_qnt_tbl[*b_vec_ptr++]; + + for(i = 1; i < 6; i++) + gain_vec[i] = extract_l(L_shr(deqnt_by_step(*b_vec_ptr++, *gss_ptr++, *ba_ptr++), 5)); + idct(gain_vec, NUM_PRED_RES_BLKS, NUM_PRED_RES_BLKS, gain_r); + + lmprbl_item = lmprbl_tbl[index]; + v_zap(t_vec, NUM_HARMS_MAX); + + // Decoding the Higher Order DCT Coefficients + t_vec_ptr = t_vec; + for(i = 0; i < NUM_PRED_RES_BLKS; i++) + { + bl_len = (lmprbl_item >> 28) & 0xF; lmprbl_item <<= 4; + v_zap(c_vec, MAX_BLOCK_LEN); + c_vec[0] = gain_r[i]; + for(j = 1; j < bl_len; j++) + { + num_bits = *ba_ptr++; + if(num_bits) + { + step_size = extract_h(((Word32)hi_ord_std_tbl[j - 1] * hi_ord_step_size_tbl[num_bits - 1]) << 1); + c_vec[j] = extract_l(L_shr(deqnt_by_step(*b_vec_ptr, step_size, num_bits), 5)); + } + else + c_vec[j] = 0; + + b_vec_ptr++; + } + idct(c_vec, bl_len, bl_len, t_vec_ptr); + t_vec_ptr += bl_len; + } + + // Calculate num_harms_prev/num_harms. Result save in unsigned format Q8.24 + if(num_harms == num_harms_prev1) + k_coef = (Word32)CNST_ONE_Q8_24; + else if(num_harms > num_harms_prev1) + k_coef = (Word32)div_s(num_harms_prev1 << 9, num_harms << 9) << 9; + else + { + // imbe_param->num_harms < num_harms_prev1 + k_coef = 0; + tmp = num_harms_prev1; + while(tmp > num_harms) + { + tmp -= num_harms; + k_coef += (Word32)CNST_ONE_Q8_24; + } + k_coef += (Word32)div_s(tmp << 9, num_harms << 9) << 9; + } + + if(num_harms <= 15) + ro_coef = CNST_0_4_Q1_15; + else if(num_harms <= 24) + ro_coef = num_harms * CNST_0_03_Q1_15 - CNST_0_05_Q1_15; + else + ro_coef = CNST_0_7_Q1_15; + + k_acc = k_coef; + sum = 0; + + for(i = num_harms_prev1 + 1; i < NUM_HARMS_MAX + 2; i++) + sa_prev1[i] = sa_prev1[num_harms_prev1]; + + for(i = 0; i < num_harms; i++) + { + index = (UWord16)(k_acc >> 24); // Get integer part + si_coef = (Word16)((k_acc - (index << 24)) >> 9); // Get fractional part + + if(si_coef == 0) + { + tmp_word32 = L_mpy_ls(sa_prev1[index], ro_coef); // sa_prev1 here is in Q10.22 format + sa_tmp[i] = L_add(L_shr(L_deposit_h(t_vec[i]), 5), tmp_word32); // Convert t_vec to Q10.22 and add ... + sum = L_add(sum, sa_prev1[index]); // sum in Q10.22 format + } + else + { + index_1 = index + 1; + tmp_word32 = L_mpy_ls(sa_prev1[index], sub(0x7FFF, si_coef)); + sum = L_add(sum, tmp_word32); + sa_tmp[i] = L_add(L_shr(L_deposit_h(t_vec[i]), 5), L_mpy_ls(tmp_word32, ro_coef)); + + tmp_word32 = L_mpy_ls(sa_prev1[index_1], si_coef); + sum = L_add(sum, tmp_word32); + sa_tmp[i] = L_add(sa_tmp[i], L_mpy_ls(tmp_word32, ro_coef)); + } + + k_acc += k_coef; + } + + imbe_param->div_one_by_num_harm_sh = tmp = norm_s(num_harms); + imbe_param->div_one_by_num_harm = tmp1 = div_s(0x4000, num_harms << tmp); // calculate 1/num_harms with scaling for better pricision + // save result to use late + + sum = L_shr(L_mpy_ls(L_mpy_ls(sum, ro_coef), tmp1), (14 - tmp)); + + for(i = 1; i <= num_harms; i++) + { + sa_prev1[i] = L_sub(sa_tmp[i - 1], sum); + sa[i - 1] = Pow2(sa_prev1[i]); + } + + num_harms_prev1 = num_harms; +} diff --git a/imbe_vocoder/src/lib/sa_decode.h b/imbe_vocoder/src/lib/sa_decode.h new file mode 100644 index 0000000..88d1e33 --- /dev/null +++ b/imbe_vocoder/src/lib/sa_decode.h @@ -0,0 +1,64 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + + +#ifndef _SA_DECODE +#define _SA_DECODE + + +//----------------------------------------------------------------------------- +// PURPOSE: +// Initialization of Spectral Amplitude Decoder +// +// +// INPUT: +// None +// +// OUTPUT: +// None +// +// RETURN: +// None +// +//----------------------------------------------------------------------------- +#if 0 +void sa_decode_init(void); + +//----------------------------------------------------------------------------- +// PURPOSE: +// Perform Spectral Amplitude Decoding +// +// +// INPUT: +// IMBE_PARAM *imbe_param - pointer to IMBE_PARAM structure with +// valid num_harms and b_vec items +// +// OUTPUT: +// None +// +// RETURN: +// Decoded Spectral Amplitudes +// +//----------------------------------------------------------------------------- +void sa_decode(IMBE_PARAM *imbe_param); +#endif + +#endif diff --git a/imbe_vocoder/src/lib/sa_encode.cc b/imbe_vocoder/src/lib/sa_encode.cc new file mode 100644 index 0000000..4c2e93e --- /dev/null +++ b/imbe_vocoder/src/lib/sa_encode.cc @@ -0,0 +1,296 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + +#include "typedef.h" +#include "globals.h" +#include "basic_op.h" +#include "imbe.h" +#include "tbls.h" +#include "qnt_sub.h" +#include "sa_encode.h" +#include "aux_sub.h" +#include "dsp_sub.h" +#include "math_sub.h" + +#include +#include +#include "encode.h" +#include "op25_imbe_vocoder.h" + + +void op25_imbe_vocoder::sa_encode_init(void) +{ + Word16 i; + num_harms_prev2 = 30; + for(i = 0; i < NUM_HARMS_MAX + 2; i++) + sa_prev2[i] = 0; +} + +void op25_imbe_vocoder::sa_encode(IMBE_PARAM *imbe_param) +{ + Word16 gain_vec[6], gain_r[6]; + UWord16 index, i, j, num_harms; + Word16 *ba_ptr, *t_vec_ptr, *b_vec_ptr, *gss_ptr, *sa_ptr; + Word16 t_vec[NUM_HARMS_MAX], c_vec[MAX_BLOCK_LEN]; + Word32 lmprbl_item; + Word16 bl_len, step_size, num_bits, tmp, ro_coef, si_coef, tmp1; + UWord32 k_coef, k_acc; + Word32 sum, tmp_word32, vec32_tmp[NUM_HARMS_MAX], *vec32_ptr; + + num_harms = imbe_param->num_harms; + + // Calculate num_harms_prev2/num_harms. Result save in unsigned format Q8.24 + if(num_harms == num_harms_prev2) + k_coef = (Word32)CNST_ONE_Q8_24; + else if(num_harms > num_harms_prev2) + k_coef = (Word32)div_s(num_harms_prev2 << 9, num_harms << 9) << 9; + else + { + // imbe_param->num_harms < num_harms_prev2 + k_coef = 0; + tmp = num_harms_prev2; + while(tmp > num_harms) + { + tmp -= num_harms; + k_coef += (Word32)CNST_ONE_Q8_24; + } + k_coef += (Word32)div_s(tmp << 9, num_harms << 9) << 9; + } + + // Calculate prediction coefficient + if(num_harms <= 15) + ro_coef = CNST_0_4_Q1_15; + else if(num_harms <= 24) + ro_coef = num_harms * CNST_0_03_Q1_15 - CNST_0_05_Q1_15; + else + ro_coef = CNST_0_7_Q1_15; + + for(i = num_harms_prev2 + 1; i < NUM_HARMS_MAX + 2; i++) + sa_prev2[i] = sa_prev2[num_harms_prev2]; + + k_acc = k_coef; + sum = 0; + sa_ptr = imbe_param->sa; + vec32_ptr = vec32_tmp; + for(i = 0; i < num_harms; i++) + { + index = (UWord16)(k_acc >> 24); // Get integer part + si_coef = (Word16)((k_acc - (index << 24)) >> 9); // Get fractional part + + + if(si_coef == 0) + { + tmp_word32 = L_mpy_ls(sa_prev2[index], ro_coef); // sa_prev2 here is in Q10.22 format + *vec32_ptr++ = L_sub(Log2(*sa_ptr++), tmp_word32); + sum = L_add(sum, sa_prev2[index]); // sum in Q10.22 format + } + else + { + tmp_word32 = L_mpy_ls(sa_prev2[index], sub(0x7FFF, si_coef)); + sum = L_add(sum, tmp_word32); + *vec32_ptr = L_sub(Log2(*sa_ptr++), L_mpy_ls(tmp_word32, ro_coef)); + + tmp_word32 = L_mpy_ls(sa_prev2[index + 1], si_coef); + sum = L_add(sum, tmp_word32); + *vec32_ptr = L_sub(*vec32_ptr, L_mpy_ls(tmp_word32, ro_coef)); + + vec32_ptr++; + } + + k_acc += k_coef; + } + + imbe_param->div_one_by_num_harm_sh = tmp = norm_s(num_harms); + imbe_param->div_one_by_num_harm = tmp1 = div_s(0x4000, num_harms << tmp); // calculate 1/num_harms with scaling for better pricision + // save result to use late + sum = L_shr(L_mpy_ls(L_mpy_ls(sum, ro_coef), tmp1), (14 - tmp)); + + for(i = 0; i < num_harms; i++) + t_vec[i] = extract_h(L_shl(L_add(vec32_tmp[i], sum), 5)); // t_vec has Q5.11 format + ////////////////////////////////////////////// + // + // Encode T vector + // + ////////////////////////////////////////////// + index = num_harms - NUM_HARMS_MIN; + + // Unpack bit allocation table's item + get_bit_allocation(num_harms, imbe_param->bit_alloc); + lmprbl_item = lmprbl_tbl[index]; + + // Encoding the Higher Order DCT Coefficients + t_vec_ptr = t_vec; + b_vec_ptr = &imbe_param->b_vec[8]; + ba_ptr = &imbe_param->bit_alloc[5]; + for(i = 0; i < NUM_PRED_RES_BLKS; i++) + { + bl_len = (lmprbl_item >> 28) & 0xF; lmprbl_item <<= 4; + + dct(t_vec_ptr, bl_len, bl_len, c_vec); + gain_vec[i] = c_vec[0]; +/* + for(j = 0; j < bl_len; j++) + printf("%g ", (double)t_vec_ptr[j]/2048.); + printf("\n"); + for(j = 0; j < bl_len; j++) + printf("%g ", (double)c_vec[j]/2048.); + printf("\n"); + printf("\n"); +*/ + for(j = 1; j < bl_len; j++) + { + num_bits = *ba_ptr++; + if(num_bits) + { + step_size = extract_h(((Word32)hi_ord_std_tbl[j - 1] * hi_ord_step_size_tbl[num_bits - 1]) << 1); + *b_vec_ptr = qnt_by_step(c_vec[j], step_size, num_bits); + } + else + *b_vec_ptr = 0; + + b_vec_ptr++; + } + t_vec_ptr += bl_len; + } + + // Encoding the Gain Vector + dct(gain_vec, NUM_PRED_RES_BLKS, NUM_PRED_RES_BLKS, gain_r); + + b_vec_ptr = &imbe_param->b_vec[2]; + ba_ptr = &imbe_param->bit_alloc[0]; + gss_ptr = (Word16 *)&gain_step_size_tbl[index * 5]; + + *b_vec_ptr++ = tbl_quant(gain_r[0], (Word16 *)&gain_qnt_tbl[0], GAIN_QNT_TBL_SIZE); + for(j = 1; j < 6; j++) + *b_vec_ptr++ = qnt_by_step(gain_r[j], *gss_ptr++, *ba_ptr++); + +/* + for(j = 0; j < NUM_PRED_RES_BLKS; j++) + printf("%g ", (double)gain_vec[j]/2048.); + printf("\n"); + for(j = 0; j < NUM_PRED_RES_BLKS; j++) + printf("%g ", (double)gain_r[j]/2048.); + printf("\n"); + printf("\n"); +*/ + + + + ////////////////////////////////////////////// + // + // Decode T vector + // + ////////////////////////////////////////////// + ba_ptr = imbe_param->bit_alloc; + b_vec_ptr = &imbe_param->b_vec[2]; + + // Decoding the Gain Vector. gain_vec has signed Q5.11 format + gss_ptr = (Word16 *)&gain_step_size_tbl[index * 5]; + gain_vec[0] = gain_qnt_tbl[*b_vec_ptr++]; + + for(i = 1; i < 6; i++) + gain_vec[i] = extract_l(L_shr(deqnt_by_step(*b_vec_ptr++, *gss_ptr++, *ba_ptr++), 5)); +/* + printf("gain deqnt\n"); + for(j = 0; j < 6; j++) + printf("%g ", (double)gain_vec[j]/2048.); + printf("\n"); +*/ + idct(gain_vec, NUM_PRED_RES_BLKS, NUM_PRED_RES_BLKS, gain_r); + + v_zap(t_vec, NUM_HARMS_MAX); + lmprbl_item = lmprbl_tbl[index]; + + // Decoding the Higher Order DCT Coefficients + t_vec_ptr = t_vec; + for(i = 0; i < NUM_PRED_RES_BLKS; i++) + { + bl_len = (lmprbl_item >> 28) & 0xF; lmprbl_item <<= 4; + v_zap(c_vec, MAX_BLOCK_LEN); + c_vec[0] = gain_r[i]; + for(j = 1; j < bl_len; j++) + { + num_bits = *ba_ptr++; + if(num_bits) + { + step_size = extract_h(((Word32)hi_ord_std_tbl[j - 1] * hi_ord_step_size_tbl[num_bits - 1]) << 1); + c_vec[j] = extract_l(L_shr(deqnt_by_step(*b_vec_ptr, step_size, num_bits), 5)); + } + else + c_vec[j] = 0; + + b_vec_ptr++; + } +/* + printf("\n"); + for(j = 0; j < bl_len; j++) + printf("%g ", (double)c_vec[j]/2048.); + printf("\n"); +*/ + idct(c_vec, bl_len, bl_len, t_vec_ptr); + t_vec_ptr += bl_len; + } +/* + printf("\n====t_vec_rec ===\n"); + for(j = 0; j < num_harms; j++) + printf("%g ", (double)t_vec[j]/2048.); + printf("\n"); +*/ + ////////////////////////////////////////////// + // + // Reconstruct Spectral Amplitudes + // + ////////////////////////////////////////////// + k_acc = k_coef; + vec32_ptr = vec32_tmp; + + for(i = num_harms_prev2 + 1; i < NUM_HARMS_MAX + 2; i++) + sa_prev2[i] = sa_prev2[num_harms_prev2]; + + for(i = 0; i < num_harms; i++) + { + index = (UWord16)(k_acc >> 24); // Get integer part + si_coef = (Word16)((k_acc - (index << 24)) >> 9); // Get fractional part + + if(si_coef == 0) + { + tmp_word32 = L_mpy_ls(sa_prev2[index], ro_coef); // sa_prev2 here is in Q10.22 format + *vec32_ptr++ = L_add(L_shr(L_deposit_h(t_vec[i]), 5), tmp_word32); // Convert t_vec to Q10.22 and add ... + } + else + { + tmp_word32 = L_mpy_ls(sa_prev2[index], sub(0x7FFF, si_coef)); + *vec32_ptr = L_add(L_shr(L_deposit_h(t_vec[i]), 5), L_mpy_ls(tmp_word32, ro_coef)); + + tmp_word32 = L_mpy_ls(sa_prev2[index + 1], si_coef); + *vec32_ptr = L_add(*vec32_ptr, L_mpy_ls(tmp_word32, ro_coef)); + + vec32_ptr++; + } + + k_acc += k_coef; + } + + for(i = 1; i <= num_harms; i++) + sa_prev2[i] = L_sub(vec32_tmp[i - 1], sum); + + num_harms_prev2 = num_harms; +} diff --git a/imbe_vocoder/src/lib/sa_encode.h b/imbe_vocoder/src/lib/sa_encode.h new file mode 100644 index 0000000..06e4145 --- /dev/null +++ b/imbe_vocoder/src/lib/sa_encode.h @@ -0,0 +1,30 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + + +#ifndef _SA_ENCODE +#define _SA_ENCODE + + +void sa_encode_init(void); +void sa_encode(IMBE_PARAM *imbe_param); + +#endif diff --git a/imbe_vocoder/src/lib/sa_enh.cc b/imbe_vocoder/src/lib/sa_enh.cc new file mode 100644 index 0000000..3b34045 --- /dev/null +++ b/imbe_vocoder/src/lib/sa_enh.cc @@ -0,0 +1,200 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + +#include "typedef.h" +#include "basic_op.h" +#include "imbe.h" +#include "qnt_sub.h" +#include "aux_sub.h" +#include "math_sub.h" +#include "sa_enh.h" + + + + +//----------------------------------------------------------------------------- +// PURPOSE: +// Perform Spectral Amplitude Enhancement +// +// +// INPUT: +// IMBE_PARAM *imbe_param - pointer to IMBE_PARAM structure with +// valid num_harms, sa and fund_freq items +// +// OUTPUT: +// None +// +// RETURN: +// Enhanced Spectral Amplitudes +// +//----------------------------------------------------------------------------- +void sa_enh(IMBE_PARAM *imbe_param) +{ + Word16 *sa, num_harm, sa_tmp[NUM_HARMS_MAX], nm; + Word16 cos_w[NUM_HARMS_MAX], i, tmp; + Word32 L_tmp, Rm0, Rm1; + Word32 w0, cos_acc; + Word32 L_den, L_num, L_Rm0_2, L_Rm1_2, L_sum_Rm02_Rm12, L_sum_mod; + Word16 Rm0Rm1, nm1, nm2, tot_nm; + Word16 Rm0_s, Rm1_s; + + + sa = imbe_param->sa; + num_harm = imbe_param->num_harms; + + v_equ(sa_tmp, sa, num_harm); + + Rm0 = L_v_magsq(sa, num_harm); + + if(Rm0 == 0) + return; + + nm = norm_l (Rm0); + if(Rm0 == MAX_32) + { + nm = 1; + v_equ_shr(sa_tmp, sa, nm, num_harm); + Rm0 = L_v_magsq(sa_tmp, num_harm); + } + else + { + if(nm > 2) + { + nm = -(nm >> 1); + v_equ_shr(sa_tmp, sa, nm, num_harm); + Rm0 = L_v_magsq(sa_tmp, num_harm); + } + } + + w0 = imbe_param->fund_freq; + + cos_acc = 0; Rm1 = 0; + for(i = 0; i < num_harm; i++) + { + cos_acc = L_add(cos_acc, w0); + + cos_w[i] = cos_fxp(extract_h(cos_acc)); + Rm1 = L_add(Rm1, L_mpy_ls(L_mult(sa_tmp[i], sa_tmp[i]), cos_w[i])); + } + + Rm0_s = extract_h(Rm0); + Rm1_s = extract_h(Rm1); + + L_Rm0_2 = L_mult(Rm0_s, Rm0_s); + L_Rm1_2 = L_mult(Rm1_s, Rm1_s); + L_den = L_sub(L_Rm0_2, L_Rm1_2); + L_den = L_mult(extract_h(L_den), Rm0_s); + nm1 = norm_l(L_den); + L_den = L_shl(L_den, nm1); + + nm2 = norm_l(w0); + L_den = L_mpy_ls(L_den, extract_h(L_shl(w0, nm2))); // Calculate w0 * Rm0 * (Rm0^2 - Rm1^2) + nm1 += nm2; // total denominator shift + + L_sum_Rm02_Rm12 = L_add(L_shr(L_Rm0_2, 2), L_shr(L_Rm1_2, 2)); + Rm0Rm1 = shr(mult_r(Rm0_s, Rm1_s), 1); + + for(i = 0; i < num_harm; i++) + { + if((((i + 1) << 3) > num_harm) && (sa_tmp[i] != 0x0000)) + { + L_num = L_sub(L_sum_Rm02_Rm12, L_mult(Rm0Rm1, cos_w[i])); + tot_nm = norm_l(L_num); + L_num = L_shl(L_num, tot_nm); + while(L_num >= L_den) + { + L_num = L_shr(L_num, 1); + tot_nm -= 1; + } + + tmp = div_s(extract_h(L_num), extract_h(L_den)); + tot_nm -= nm1; + + L_tmp = L_mult(sa_tmp[i], sa_tmp[i]); + nm2 = norm_l(L_tmp); + L_tmp = L_shl(L_tmp, nm2); + L_tmp = L_mult(extract_h(L_tmp), tmp); + tot_nm += nm2; + tot_nm -= 2; + + if(tot_nm <= 0) + { + L_tmp = L_shr(L_tmp, add(8, tot_nm)); + L_tmp = sqrt_l_exp(L_tmp, &tot_nm); + L_tmp = L_shr(L_tmp, tot_nm); + L_tmp = sqrt_l_exp(L_tmp, &tot_nm); + L_tmp = L_shr(L_tmp, tot_nm); + L_tmp = L_mult(extract_h(L_tmp), CNST_0_9898_Q1_15); + tmp = extract_h(L_shl(L_tmp, 1)); + } + else + { + if(tot_nm <= 8) + { + L_tmp = L_shr(L_tmp, tot_nm); + L_tmp = sqrt_l_exp(L_tmp, &tot_nm); + L_tmp = L_shr(L_tmp, tot_nm); + L_tmp = sqrt_l_exp(L_tmp, &tot_nm); + L_tmp = L_shr(L_tmp, tot_nm + 1); + tmp = mult(extract_h(L_tmp), CNST_0_9898_Q1_15); + } + else + { + nm1 = tot_nm & 0xFFFE; + L_tmp = L_shr(L_tmp, tot_nm - nm1); + L_tmp = sqrt_l_exp(L_tmp, &tot_nm); + L_tmp = L_shr(L_tmp, tot_nm); + tot_nm = nm1 >> 1; + + nm1 = tot_nm & 0xFFFE; + L_tmp = L_shr(L_tmp, tot_nm - nm1); + L_tmp = sqrt_l_exp(L_tmp, &tot_nm); + L_tmp = L_shr(L_tmp, tot_nm); + L_tmp = L_mult(extract_h(L_tmp), CNST_0_9898_Q1_15); + tot_nm = nm1 >> 1; + tmp = extract_h(L_shr(L_tmp, tot_nm + 1)); + } + } + + if(tmp > CNST_1_2_Q2_14) + sa[i] = extract_h(L_shl(L_mult(sa[i], CNST_1_2_Q2_14), 1)); + else if(tmp < CNST_0_5_Q2_14) + sa[i] = shr(sa[i], 1); + else + sa[i] = extract_h(L_shl(L_mult(sa[i], tmp), 1)); + } + } + + // Compute the correct scale factor + v_equ_shr(sa_tmp, sa, nm, num_harm); + L_sum_mod = L_v_magsq(sa_tmp, num_harm); + if(L_sum_mod > Rm0) + { + tmp = div_s(extract_h(Rm0), extract_h(L_sum_mod)); + L_tmp = sqrt_l_exp(L_deposit_h(tmp), &tot_nm); + tmp = shr(extract_h(L_tmp), tot_nm); + for(i = 0; i < num_harm; i++) + sa[i] = mult_r(sa[i], tmp); + } +} + + + diff --git a/imbe_vocoder/src/lib/sa_enh.h b/imbe_vocoder/src/lib/sa_enh.h new file mode 100644 index 0000000..6b3f277 --- /dev/null +++ b/imbe_vocoder/src/lib/sa_enh.h @@ -0,0 +1,50 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + + +#ifndef _SA_ENH +#define _SA_ENH + +#define CNST_0_9898_Q1_15 0x7EB3 +#define CNST_0_5_Q2_14 0x2000 +#define CNST_1_2_Q2_14 0x4CCC + + +//----------------------------------------------------------------------------- +// PURPOSE: +// Perform Spectral Amplitude Enhancement +// +// +// INPUT: +// IMBE_PARAM *imbe_param - pointer to IMBE_PARAM structure with +// valid num_harms, sa and fund_freq items +// +// OUTPUT: +// None +// +// RETURN: +// Enhanced Spectral Amplitudes +// +//----------------------------------------------------------------------------- +void sa_enh(IMBE_PARAM *imbe_param); + + +#endif diff --git a/imbe_vocoder/src/lib/tbls.cc b/imbe_vocoder/src/lib/tbls.cc new file mode 100644 index 0000000..fb9ccf8 --- /dev/null +++ b/imbe_vocoder/src/lib/tbls.cc @@ -0,0 +1,368 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ +#include "typedef.h" +#include "tbls.h" + + +//----------------------------------------------------------------------------- +// +// Bit allocation and ancillary tables +// +//----------------------------------------------------------------------------- +const Word16 bit_allocation_tbl[] = +{ + 0xA999, 0x9987, + 0x9988, 0x8976, 0x5000, + 0x8887, 0x7976, 0x5400, + 0x8777, 0x7876, 0x5430, + 0x7776, 0x6776, 0x5433, + 0x7666, 0x6775, 0x4434, 0x3000, + 0x7666, 0x5675, 0x4433, 0x3300, + 0x6665, 0x5665, 0x4433, 0x3320, + 0x6655, 0x5555, 0x4443, 0x3232, + 0x6555, 0x5545, 0x5433, 0x3322, 0x2000, + 0x6554, 0x4545, 0x4433, 0x3323, 0x2100, + 0x6554, 0x4545, 0x4433, 0x2321, 0x3210, + 0x5554, 0x4445, 0x4433, 0x2232, 0x1321, + 0x5544, 0x4444, 0x4432, 0x3223, 0x2122, 0x1000, + 0x5444, 0x4434, 0x4343, 0x2322, 0x2212, 0x2100, + 0x5444, 0x4433, 0x4333, 0x3232, 0x1221, 0x2210, + 0x5444, 0x3433, 0x4333, 0x3232, 0x1221, 0x2111, + 0x5443, 0x3433, 0x4333, 0x2232, 0x1221, 0x1221, 0x1000, + 0x5443, 0x3432, 0x4323, 0x2232, 0x2122, 0x1122, 0x1100, + 0x4443, 0x3432, 0x4323, 0x2223, 0x2112, 0x2112, 0x1110, + 0x4443, 0x3332, 0x4322, 0x3222, 0x3211, 0x2111, 0x2111, + 0x4443, 0x3332, 0x2332, 0x2322, 0x1321, 0x1211, 0x1211, 0x1000, + 0x4433, 0x3332, 0x2332, 0x2322, 0x1221, 0x1211, 0x1211, 0x1100, + 0x4433, 0x3332, 0x2332, 0x2322, 0x1221, 0x1211, 0x1121, 0x1100, + 0x4333, 0x3332, 0x2332, 0x2321, 0x1221, 0x1121, 0x1112, 0x1111, + 0x4333, 0x3322, 0x2322, 0x2322, 0x1122, 0x1112, 0x1111, 0x2111, 0x0000, + 0x4333, 0x3322, 0x2322, 0x2232, 0x1112, 0x2111, 0x2111, 0x0211, 0x1000, + 0x4333, 0x3322, 0x2132, 0x2213, 0x2111, 0x2211, 0x1211, 0x1021, 0x1100, + 0x4333, 0x2322, 0x2132, 0x2223, 0x2111, 0x2111, 0x1211, 0x1021, 0x1110, + 0x4333, 0x2322, 0x2132, 0x2213, 0x2111, 0x2111, 0x1211, 0x1102, 0x1111, 0x0000, + 0x4333, 0x2322, 0x2132, 0x2213, 0x2111, 0x2211, 0x1021, 0x1110, 0x2111, 0x0000, + 0x4333, 0x2322, 0x2132, 0x2113, 0x2111, 0x1221, 0x1102, 0x1111, 0x0211, 0x1000, + 0x4332, 0x2322, 0x1132, 0x2211, 0x3211, 0x1122, 0x1110, 0x2111, 0x1021, 0x1100, + 0x4332, 0x2322, 0x2113, 0x2221, 0x1221, 0x1112, 0x2111, 0x0211, 0x1002, 0x1110, 0x0000, + 0x4332, 0x2322, 0x2113, 0x2221, 0x1221, 0x1112, 0x1111, 0x0211, 0x1002, 0x1111, 0x0000, + 0x4332, 0x2322, 0x1113, 0x2221, 0x1221, 0x1112, 0x1111, 0x0211, 0x1100, 0x2111, 0x1000, + 0x4332, 0x2322, 0x1113, 0x2211, 0x1221, 0x1112, 0x2111, 0x0021, 0x1110, 0x0211, 0x1100, + 0x3332, 0x2322, 0x1113, 0x2211, 0x1221, 0x1111, 0x2211, 0x1002, 0x1111, 0x0021, 0x1110, 0x0000, + 0x3332, 0x2322, 0x1113, 0x2211, 0x1122, 0x1111, 0x1221, 0x1100, 0x2111, 0x1002, 0x1110, 0x0000, + 0x3332, 0x2322, 0x1111, 0x3221, 0x1112, 0x2111, 0x1122, 0x1110, 0x0211, 0x1000, 0x2111, 0x0000, + 0x3332, 0x2322, 0x1111, 0x3221, 0x1112, 0x2111, 0x1022, 0x1110, 0x0211, 0x1000, 0x2111, 0x1000, + 0x3332, 0x2322, 0x1111, 0x3221, 0x1112, 0x2111, 0x1022, 0x1110, 0x0211, 0x1100, 0x0211, 0x1000, 0x0000, + 0x3332, 0x2322, 0x1111, 0x3211, 0x1112, 0x2111, 0x1022, 0x1110, 0x0021, 0x1110, 0x0021, 0x1110, 0x0000, + 0x3322, 0x2321, 0x1111, 0x3221, 0x1112, 0x2111, 0x1102, 0x2111, 0x0002, 0x1111, 0x0002, 0x1111, 0x0000, + 0x3322, 0x2321, 0x1111, 0x3221, 0x1111, 0x2211, 0x1110, 0x2211, 0x1000, 0x2111, 0x1000, 0x2111, 0x0000, + 0x3322, 0x2322, 0x1111, 0x0322, 0x1111, 0x0221, 0x1111, 0x0221, 0x1100, 0x0211, 0x1100, 0x0211, 0x1000, 0x0000, + 0x3322, 0x2322, 0x1111, 0x0322, 0x1111, 0x0221, 0x1111, 0x0221, 0x1100, 0x0211, 0x1000, 0x0211, 0x1100, 0x0000, + 0x3322, 0x2322, 0x1111, 0x0322, 0x1111, 0x0221, 0x1111, 0x0221, 0x1100, 0x0211, 0x1100, 0x0021, 0x1100, 0x0000 +}; + +const Word16 bit_allocation_offset_tbl[] = +{ + 0x0002, 0x000E, 0x001E, 0x0032, 0x004A, 0x0066, 0x0086, 0x00AA, 0x00D2, 0x00FE, 0x012E, 0x0162 +}; + +//----------------------------------------------------------------------------- +// +// Log Magnitude Prediction Residual Block Length +// +//----------------------------------------------------------------------------- +const Word32 lmprbl_tbl[] = +{ + 0x11122200, + 0x11222200, + 0x12222200, + 0x22222200, + 0x22222300, + 0x22223300, + 0x22233300, + 0x22333300, + 0x23333300, + 0x33333300, + 0x33333400, + 0x33334400, + 0x33344400, + 0x33444400, + 0x34444400, + 0x44444400, + 0x44444500, + 0x44445500, + 0x44455500, + 0x44555500, + 0x45555500, + 0x55555500, + 0x55555600, + 0x55556600, + 0x55566600, + 0x55666600, + 0x56666600, + 0x66666600, + 0x66666700, + 0x66667700, + 0x66677700, + 0x66777700, + 0x67777700, + 0x77777700, + 0x77777800, + 0x77778800, + 0x77788800, + 0x77888800, + 0x78888800, + 0x88888800, + 0x88888900, + 0x88889900, + 0x88899900, + 0x88999900, + 0x89999900, + 0x99999900, + 0x99999A00, + 0x9999AA00 +}; + + + +//----------------------------------------------------------------------------- +// +// Gain Quantizer Levels in signed Q5.11 format +// +//----------------------------------------------------------------------------- +const Word16 gain_qnt_tbl[] = +{ + -5821, -5518, -5239, -4880, -4549, -4292, -4057, -3760, -3370, -2903, + -2583, -2305, -1962, -1601, -1138, -711, -302, 57, 433, 795, + 1132, 1510, 1909, 2333, 2705, 3038, 3376, 3689, 3979, 4339, + 4754, 5129, 5435, 5695, 5991, 6300, 6596, 6969, 7342, 7751, + 8101, 8511, 8835, 9102, 9375, 9698, 10055, 10415, 10762, 11084, + 11403, 11752, 12123, 12468, 12863, 13239, 13615, 13997, 14382, 14770, + 15301, 15849, 16640, 17809 +}; + + +//----------------------------------------------------------------------------- +// +// Gain Ste Size in unsigned Q0.16 format +// +//----------------------------------------------------------------------------- +const UWord16 gain_step_size_tbl[] = +{ + 203, 263, 220, 190, 173, + 406, 263, 440, 380, 346, + 813, 527, 440, 760, 692, + 813, 1054, 881, 760, 692, + 1625, 1054, 881, 1425, 1298, + 1625, 1976, 1652, 1425, 1298, + 1625, 1976, 1652, 1425, 2422, + 3047, 1976, 1652, 2661, 2422, + 3047, 1976, 3083, 2661, 2422, + 3047, 3688, 3083, 2661, 2422, + 3047, 3688, 3083, 3801, 3460, + 3047, 3688, 3083, 3801, 3460, + 5689, 3688, 3083, 3801, 3460, + 5689, 3688, 4404, 3801, 3460, + 5689, 5269, 4404, 3801, 3460, + 5689, 5269, 4404, 3801, 3460, + 5689, 5269, 4404, 3801, 5623, + 5689, 5269, 4404, 6177, 5623, + 5689, 5269, 4404, 6177, 5623, + 8126, 5269, 4404, 6177, 5623, + 8126, 5269, 4404, 6177, 5623, + 8126, 5269, 4404, 6177, 5623, + 8126, 5269, 7157, 6177, 5623, + 8126, 5269, 7157, 6177, 5623, + 8126, 8562, 7157, 6177, 5623, + 8126, 8562, 7157, 6177, 5623, + 8126, 8562, 7157, 6177, 5623, + 8126, 8562, 7157, 6177, 5623, + 8126, 8562, 7157, 6177, 7353, + 8126, 8562, 7157, 6177, 7353, + 8126, 8562, 7157, 6177, 7353, + 8126, 8562, 7157, 6177, 7353, + 8126, 8562, 7157, 8077, 7353, + 8126, 8562, 7157, 8077, 7353, + 8126, 8562, 7157, 8077, 7353, + 8126, 8562, 7157, 8077, 7353, + 8126, 8562, 7157, 8077, 7353, + 13206, 8562, 7157, 8077, 7353, + 13206, 8562, 7157, 8077, 7353, + 13206, 8562, 7157, 8077, 7353, + 13206, 8562, 7157, 8077, 7353, + 13206, 8562, 7157, 8077, 7353, + 13206, 8562, 7157, 8077, 7353, + 13206, 8562, 9359, 8077, 7353, + 13206, 8562, 9359, 8077, 7353, + 13206, 8562, 9359, 8077, 7353, + 13206, 8562, 9359, 8077, 7353, + 13206, 8562, 9359, 8077, 7353 +}; + + +//----------------------------------------------------------------------------- +// +// Standard Deviation of Higher Order DCT Coefficients in unsigned Q0.16 format +// +//----------------------------------------------------------------------------- +const UWord16 hi_ord_std_tbl[] = +{ + 20120, 15794, 13566, 12452, 11731, 11338, 10813, 11141, 11141 +}; + +//----------------------------------------------------------------------------- +// +// Quantizer Step for Higher Order DCT Coefficients in unsigned Q1.15 format +// +//----------------------------------------------------------------------------- +const UWord16 hi_ord_step_size_tbl[] = +{ + 39322, 27853, 21299, 13107, 9175, 4915, 2621, 1311, 655, 328 +}; + +//----------------------------------------------------------------------------- +// +// Speech Synthesis Window +// +//----------------------------------------------------------------------------- +const Word16 ws[49] = +{ + 655, 1310, 1966, 2621, 3276, 3932, 4587, 5242, 5898, 6553, + 7208, 7864, 8519, 9175, 9830, 10485, 11141, 11796, 12451, 13107, + 13762, 14417, 15073, 15728, 16384, 17039, 17694, 18350, 19005, 19660, + 20316, 20971, 21626, 22282, 22937, 23592, 24248, 24903, 25559, 26214, + 26869, 27525, 28180, 28835, 29491, 30146, 30801, 31457, 32112 +}; + +/* +const Word16 ws_ws[49] = +{ + + 17052, 17746, 18467, 19212, 19980, 20770, 21580, 22407, 23246, 24094, + 24945, 25793, 26631, 27453, 28248, 29008, 29724, 30385, 30983, 31507, + 31950, 32302, 32559, 32715, 32767, 32715, 32559, 32302, 31950, 31507, + 30983, 30385, 29724, 29008, 28248, 27453, 26631, 25793, 24945, 24094, + 23246, 22407, 21580, 20770, 19980, 19212, 18467, 17746, 17052 +}; +*/ + +//----------------------------------------------------------------------------- +// +// Squared Pitch Estimation Window 64*wi^2 +// +//----------------------------------------------------------------------------- +const Word16 wi[301] = +{ + 15, 18, 21, 25, 29, 34, 40, 46, 52, 59, + 67, 76, 86, 96, 108, 120, 133, 148, 164, 180, + 199, 218, 239, 261, 285, 311, 338, 367, 398, 431, + 465, 502, 541, 582, 625, 671, 719, 769, 822, 878, + 936, 997, 1061, 1128, 1198, 1271, 1347, 1426, 1508, 1594, + 1683, 1775, 1871, 1970, 2073, 2179, 2289, 2403, 2520, 2641, + 2766, 2894, 3026, 3162, 3301, 3445, 3592, 3742, 3897, 4055, + 4216, 4382, 4551, 4723, 4899, 5078, 5261, 5447, 5636, 5828, + 6023, 6221, 6423, 6626, 6833, 7042, 7253, 7467, 7683, 7900, + 8120, 8341, 8564, 8788, 9014, 9241, 9468, 9696, 9925, 10154, + 10383, 10613, 10842, 11070, 11298, 11525, 11752, 11977, 12200, 12422, + 12642, 12860, 13076, 13289, 13500, 13708, 13912, 14114, 14312, 14506, + 14696, 14882, 15064, 15242, 15414, 15582, 15745, 15903, 16055, 16202, + 16343, 16478, 16608, 16731, 16848, 16958, 17062, 17159, 17250, 17333, + 17410, 17480, 17542, 17597, 17646, 17686, 17720, 17746, 17764, 17776, + 17779, 17776, 17764, 17746, 17720, 17686, 17646, 17597, 17542, 17480, + 17410, 17333, 17250, 17159, 17062, 16958, 16848, 16731, 16608, 16478, + 16343, 16202, 16055, 15903, 15745, 15582, 15414, 15242, 15064, 14882, + 14696, 14506, 14312, 14114, 13912, 13708, 13500, 13289, 13076, 12860, + 12642, 12422, 12200, 11977, 11752, 11525, 11298, 11070, 10842, 10613, + 10383, 10154, 9925, 9696, 9468, 9241, 9014, 8788, 8564, 8341, + 8120, 7900, 7683, 7467, 7253, 7042, 6833, 6626, 6423, 6221, + 6023, 5828, 5636, 5447, 5261, 5078, 4899, 4723, 4551, 4382, + 4216, 4055, 3897, 3742, 3592, 3445, 3301, 3162, 3026, 2894, + 2766, 2641, 2520, 2403, 2289, 2179, 2073, 1970, 1871, 1775, + 1683, 1594, 1508, 1426, 1347, 1271, 1198, 1128, 1061, 997, + 936, 878, 822, 769, 719, 671, 625, 582, 541, 502, + 465, 431, 398, 367, 338, 311, 285, 261, 239, 218, + 199, 180, 164, 148, 133, 120, 108, 96, 86, 76, + 67, 59, 52, 46, 40, 34, 29, 25, 21, 18, + 15 +}; + +//----------------------------------------------------------------------------- +// +// Pitch Refinement Window +// +//----------------------------------------------------------------------------- +const Word16 wr[] = +{ + 487, 570, 658, 753, 854, 962, 1076, 1197, 1325, 1460, + 1602, 1752, 1909, 2074, 2246, 2426, 2614, 2810, 3014, 3227, + 3447, 3675, 3912, 4157, 4410, 4671, 4941, 5219, 5505, 5799, + 6101, 6411, 6729, 7054, 7388, 7728, 8077, 8432, 8795, 9164, + 9541, 9923, 10312, 10707, 11108, 11515, 11927, 12344, 12766, 13192, + 13622, 14056, 14494, 14935, 15379, 15825, 16273, 16724, 17175, 17628, + 18081, 18534, 18988, 19440, 19892, 20342, 20790, 21237, 21680, 22120, + 22557, 22990, 23419, 23842, 24261, 24673, 25080, 25480, 25874, 26259, + 26638, 27008, 27370, 27722, 28066, 28400, 28724, 29037, 29340, 29632, + 29912, 30181, 30438, 30683, 30915, 31135, 31341, 31535, 31715, 31881, + 32033, 32172, 32296, 32406, 32502, 32583, 32649, 32701, 32738, 32760, +}; + +//----------------------------------------------------------------------------- +// +// Real Part Spectrum of Pitch Refinement Window * 256 +// +//----------------------------------------------------------------------------- +const Word16 wr_sp[] = +{ + 16, 43, 71, 102, 135, 170, 207, 247, 289, 333, + 380, 430, 483, 538, 596, 657, 721, 787, 857, 930, + 1006, 1085, 1168, 1254, 1343, 1435, 1531, 1630, 1733, 1840, + 1950, 2063, 2181, 2302, 2426, 2555, 2687, 2823, 2962, 3106, + 3253, 3404, 3559, 3718, 3881, 4047, 4218, 4392, 4570, 4751, + 4937, 5126, 5319, 5516, 5716, 5920, 6128, 6339, 6554, 6772, + 6994, 7219, 7447, 7679, 7914, 8152, 8393, 8637, 8884, 9134, + 9387, 9642, 9900, 10160, 10423, 10688, 10956, 11225, 11497, 11770, + 12045, 12322, 12601, 12881, 13162, 13444, 13728, 14012, 14298, 14584, + 14871, 15158, 15445, 15733, 16020, 16308, 16595, 16882, 17168, 17454, + 17738, 18022, 18305, 18586, 18866, 19145, 19421, 19696, 19969, 20240, + 20508, 20774, 21037, 21298, 21556, 21811, 22062, 22310, 22555, 22796, + 23033, 23267, 23496, 23722, 23943, 24159, 24372, 24579, 24782, 24980, + 25172, 25360, 25542, 25719, 25891, 26057, 26217, 26372, 26520, 26663, + 26800, 26930, 27055, 27173, 27285, 27390, 27489, 27581, 27667, 27746, + 27818, 27884, 27942, 27994, 28039, 28078, 28109, 28133, 28151, 28161, + 28165, 28161, 28151, 28133, 28109, 28078, 28039, 27994, 27942, 27884, + 27818, 27746, 27667, 27581, 27489, 27390, 27285, 27173, 27055, 26930, + 26800, 26663, 26520, 26372, 26217, 26057, 25891, 25719, 25542, 25360, + 25172, 24980, 24782, 24579, 24372, 24159, 23943, 23722, 23496, 23267, + 23033, 22796, 22555, 22310, 22062, 21811, 21556, 21298, 21037, 20774, + 20508, 20240, 19969, 19696, 19421, 19145, 18866, 18586, 18305, 18022, + 17738, 17454, 17168, 16882, 16595, 16308, 16020, 15733, 15445, 15158, + 14871, 14584, 14298, 14012, 13728, 13444, 13162, 12881, 12601, 12322, + 12045, 11770, 11497, 11225, 10956, 10688, 10423, 10160, 9900, 9642, + 9387, 9134, 8884, 8637, 8393, 8152, 7914, 7679, 7447, 7219, + 6994, 6772, 6554, 6339, 6128, 5920, 5716, 5516, 5319, 5126, + 4937, 4751, 4570, 4392, 4218, 4047, 3881, 3718, 3559, 3404, + 3253, 3106, 2962, 2823, 2687, 2555, 2426, 2302, 2181, 2063, + 1950, 1840, 1733, 1630, 1531, 1435, 1343, 1254, 1168, 1085, + 1006, 930, 857, 787, 721, 657, 596, 538, 483, 430, + 380, 333, 289, 247, 207, 170, 135, 102, 71, 43, + 16 +}; + diff --git a/imbe_vocoder/src/lib/tbls.h b/imbe_vocoder/src/lib/tbls.h new file mode 100644 index 0000000..f83387b --- /dev/null +++ b/imbe_vocoder/src/lib/tbls.h @@ -0,0 +1,99 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + +#ifndef _TBLS +#define _TBLS + + +//----------------------------------------------------------------------------- +// +// Bit allocation and ancillary tables +// +//----------------------------------------------------------------------------- +extern const Word16 bit_allocation_tbl[]; +extern const Word16 bit_allocation_offset_tbl[]; + +//----------------------------------------------------------------------------- +// +// Log Magnitude Prediction Residual Block Length +// +//----------------------------------------------------------------------------- +extern const Word32 lmprbl_tbl[]; + +//----------------------------------------------------------------------------- +// +// Gain Quantizer Levels in Q5.11 format +// +//----------------------------------------------------------------------------- +extern const Word16 gain_qnt_tbl[]; +#define GAIN_QNT_TBL_SIZE 64 + +//----------------------------------------------------------------------------- +// +// Gain Ste Size in unsigned Q0.16 format +// +//----------------------------------------------------------------------------- +extern const UWord16 gain_step_size_tbl[]; + +//----------------------------------------------------------------------------- +// +// Standard Deviation of Higher Order DCT Coefficients in unsigned Q0.16 format +// +//----------------------------------------------------------------------------- +extern const UWord16 hi_ord_std_tbl[]; + +//----------------------------------------------------------------------------- +// +// Quantizer Step for Higher Order DCT Coefficients in unsigned Q1.15 format +// +//----------------------------------------------------------------------------- +extern const UWord16 hi_ord_step_size_tbl[]; + +//----------------------------------------------------------------------------- +// +// Speech Synthesis Window +// +//----------------------------------------------------------------------------- +extern const Word16 ws[]; + +//----------------------------------------------------------------------------- +// +// Squared Pitch Estimation Window 64*wi^2 +// +//----------------------------------------------------------------------------- +extern const Word16 wi[]; + +//----------------------------------------------------------------------------- +// +// Pitch Refinement Window +// +//----------------------------------------------------------------------------- +extern const Word16 wr[]; + +//----------------------------------------------------------------------------- +// +// Real Part Spectrum of Pitch Refinement Window * 256 +// +//----------------------------------------------------------------------------- +extern const Word16 wr_sp[]; + +#endif + diff --git a/imbe_vocoder/src/lib/typedef.h b/imbe_vocoder/src/lib/typedef.h new file mode 100644 index 0000000..c62c4c7 --- /dev/null +++ b/imbe_vocoder/src/lib/typedef.h @@ -0,0 +1,74 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ +/* +******************************************************************************** +* +* GSM AMR speech codec Version 7.4.0 January 31, 2000 +* +******************************************************************************** +* +* File : typedef.c +* Purpose : Basic types. +* +******************************************************************************** +*/ +#ifndef typedef_h +#define typedef_h "$Id $" + +#undef ORIGINAL_TYPEDEF_H /* define to get "original" ETSI version + of typedef.h */ + +#ifdef ORIGINAL_TYPEDEF_H +/* + * this is the original code from the ETSI file typedef.h + */ + +#if defined(__BORLANDC__) || defined(__WATCOMC__) || defined(_MSC_VER) || defined(__ZTC__) +typedef signed char Word8; +typedef short Word16; +typedef long Word32; +typedef int Flag; + +#elif defined(__sun) +typedef signed char Word8; +typedef short Word16; +typedef long Word32; +typedef int Flag; + +#elif defined(__unix__) || defined(__unix) +typedef signed char Word8; +typedef short Word16; +typedef int Word32; +typedef int Flag; + +#endif +#else /* not original typedef.h */ + +/* + * use (improved) type definition file typdefs.h and add a "Flag" type + */ +#include "typedefs.h" +typedef int Flag; + +#endif + +#endif + diff --git a/imbe_vocoder/src/lib/typedefs.h b/imbe_vocoder/src/lib/typedefs.h new file mode 100644 index 0000000..d86550b --- /dev/null +++ b/imbe_vocoder/src/lib/typedefs.h @@ -0,0 +1,201 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ +/* +******************************************************************************** +* +* GSM AMR speech codec Version 7.4.0 January 31, 2000 +* +******************************************************************************** +* +* File : typedefs.h +* Description : Definition of platform independent data +* types and constants +* +* +* The following platform independent data types and corresponding +* preprocessor (#define) constants are defined: +* +* defined type meaning corresponding constants +* ---------------------------------------------------------- +* Char character (none) +* Bool boolean true, false +* Word8 8-bit signed minWord8, maxWord8 +* UWord8 8-bit unsigned minUWord8, maxUWord8 +* Word16 16-bit signed minWord16, maxWord16 +* UWord16 16-bit unsigned minUWord16, maxUWord16 +* Word32 32-bit signed minWord32, maxWord32 +* UWord32 32-bit unsigned minUWord32, maxUWord32 +* Float floating point minFloat, maxFloat +* +* +* The following compile switches are #defined: +* +* PLATFORM string indicating platform progam is compiled on +* possible values: "OSF", "PC", "SUN" +* +* OSF only defined if the current platform is an Alpha +* PC only defined if the current platform is a PC +* SUN only defined if the current platform is a Sun +* +* LSBFIRST is defined if the byte order on this platform is +* "least significant byte first" -> defined on DEC Alpha +* and PC, undefined on Sun +* +******************************************************************************** +*/ +#ifndef typedefs_h +#define typedefs_h "$Id $" + +/* +******************************************************************************** +* INCLUDE FILES +******************************************************************************** +*/ +#include +#include + +#define __MSDOS__ + +/* +******************************************************************************** +* DEFINITION OF CONSTANTS +******************************************************************************** +*/ +/* + ********* define char type + */ +typedef char Char; + +/* + ********* define 8 bit signed/unsigned types & constants + */ +#if SCHAR_MAX == 127 +typedef signed char Word8; +#define minWord8 SCHAR_MIN +#define maxWord8 SCHAR_MAX + +typedef unsigned char UWord8; +#define minUWord8 0 +#define maxUWord8 UCHAR_MAX +#else +#error cannot find 8-bit type +#endif + + +/* + ********* define 16 bit signed/unsigned types & constants + */ +#if INT_MAX == 32767 +typedef int Word16; +#define minWord16 INT_MIN +#define maxWord16 INT_MAX +typedef unsigned int UWord16; +#define minUWord16 0 +#define maxUWord16 UINT_MAX +#elif SHRT_MAX == 32767 +typedef short Word16; +#define minWord16 SHRT_MIN +#define maxWord16 SHRT_MAX +typedef unsigned short UWord16; +#define minUWord16 0 +#define maxUWord16 USHRT_MAX +#else +#error cannot find 16-bit type +#endif + + +/* + ********* define 32 bit signed/unsigned types & constants + */ +#if INT_MAX == 2147483647 +typedef int Word32; +#define minWord32 INT_MIN +#define maxWord32 INT_MAX +typedef unsigned int UWord32; +#define minUWord32 0 +#define maxUWord32 UINT_MAX +#elif LONG_MAX == 2147483647 +typedef long Word32; +#define minWord32 LONG_MIN +#define maxWord32 LONG_MAX +typedef unsigned long UWord32; +#define minUWord32 0 +#define maxUWord32 ULONG_MAX +#else +#error cannot find 32-bit type +#endif + +/* + ********* define floating point type & constants + */ +/* use "#if 0" below if Float should be double; + use "#if 1" below if Float should be float + */ +#if 0 +typedef float Float; +#define maxFloat FLT_MAX +#define minFloat FLT_MIN +#else +typedef double Float; +#define maxFloat DBL_MAX +#define minFloat DBL_MIN +#endif + +/* + ********* define complex type + */ +typedef struct { + Float r; /* real part */ + Float i; /* imaginary part */ +} CPX; + +/* + ********* define boolean type + */ +typedef int Bool; +#define false 0 +#define true 1 + +/* + ********* Check current platform + */ +#if defined(__MSDOS__) +#define PC +#define PLATFORM "PC" +#define LSBFIRST +#elif defined(__osf__) +#define OSF +#define PLATFORM "OSF" +#define LSBFIRST +#elif defined(__sun__) || defined(__sun) +#define SUN +#define PLATFORM "SUN" +#undef LSBFIRST +#elif defined(linux) && defined(i386) +#define PC +#define PLATFORM "PC" +#define LSBFIRST +#else +#error "can't determine architecture; adapt typedefs.h to your platform" +#endif + +#endif + diff --git a/imbe_vocoder/src/lib/uv_synt.cc b/imbe_vocoder/src/lib/uv_synt.cc new file mode 100644 index 0000000..c5eabf7 --- /dev/null +++ b/imbe_vocoder/src/lib/uv_synt.cc @@ -0,0 +1,147 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + +#include "typedef.h" +#include "basic_op.h" +#include "imbe.h" +#include "aux_sub.h" +#include "dsp_sub.h" +#include "math_sub.h" +#include "uv_synt.h" +#include "rand_gen.h" +#include "tbls.h" +#include "encode.h" +#include "op25_imbe_vocoder.h" + + + + +void op25_imbe_vocoder::uv_synt_init(void) +{ + fft_init(); + v_zap(uv_mem, 105); +} + + + + + + +void op25_imbe_vocoder::uv_synt(IMBE_PARAM *imbe_param, Word16 *snd) +{ + Cmplx16 Uw[FFTLENGTH]; + Word16 i, index_a, index_b, index_aux, ha, hb, *v_uv_dsn_ptr, *sa_ptr, sa; + Word32 fund_freq, fund_freq_2, fund_freq_acc_a, fund_freq_acc_b; + + sa_ptr = imbe_param->sa; + v_uv_dsn_ptr = imbe_param->v_uv_dsn; + fund_freq = imbe_param->fund_freq; + fund_freq_2 = L_shr(fund_freq, 1); + + v_zap((Word16 *)&Uw, 2 * FFTLENGTH); + + fund_freq_acc_a = L_sub(fund_freq, fund_freq_2); + fund_freq_acc_b = L_add(fund_freq, fund_freq_2); + + for(i = 0; i < imbe_param->num_harms; i++) + { + ha = extract_h(fund_freq_acc_a); + hb = extract_h(fund_freq_acc_b); + index_a = (ha >> 8) + ((ha & 0xFF)?1:0); + index_b = (hb >> 8) + ((hb & 0xFF)?1:0); + + index_aux = 256 - index_a; + + sa = shl(*sa_ptr, 3); + + if(*v_uv_dsn_ptr++) + { + while(index_a < index_b) + { + Uw[index_a].re = Uw[index_a].im = 0; + Uw[index_aux].re = Uw[index_aux].im = 0; + index_a++; + index_aux--; + } + } + else + { + while(index_a < index_b) + { + Uw[index_a].re = mult(sa, rand_gen()); + Uw[index_a].im = mult(sa, rand_gen()); + //Uw[index_a].re = sa; + //Uw[index_a].im = sa; + + Uw[index_aux].re = Uw[index_a].re; + Uw[index_aux].im = negate(Uw[index_a].im); + index_a++; + index_aux--; + } + } + + fund_freq_acc_a = L_add(fund_freq_acc_a, fund_freq); + fund_freq_acc_b = L_add(fund_freq_acc_b, fund_freq); + sa_ptr++; + } + +/* + j = 128; + for(i = 0; i < 128; i++) + Uw_tmp[j++] = Uw[i]; + + j = 128; + for(i = 0; i < 128; i++) + Uw_tmp[i] = Uw[j++]; + + for(i = 0; i < 256; i++) + Uw[i] = Uw_tmp[i]; +*/ + + + fft((Word16 *)&Uw, FFTLENGTH, -1); + + for(i = 0; i < 105; i++) + snd[i] = uv_mem[i]; + + index_aux = 73; + for(i = 105; i < FRAME; i++) + snd[i] = shl(Uw[index_aux++].re, 3); + + + // Weighted Overlap Add Algorithm + index_aux = 24; + index_a = 0; + index_b = 48; + for(i = 56; i < 105; i++) + { + snd[i] = extract_h(L_add(L_mult(snd[i], ws[index_b]), L_mult(shl(Uw[index_aux].re, 3), ws[index_a]))); + + index_aux++; + index_a++; + index_b--; + } + + index_aux = 128; + for(i = 0; i < 105; i++) + uv_mem[i] = shl(Uw[index_aux++].re, 3); +} + diff --git a/imbe_vocoder/src/lib/uv_synt.h b/imbe_vocoder/src/lib/uv_synt.h new file mode 100644 index 0000000..ef04cb7 --- /dev/null +++ b/imbe_vocoder/src/lib/uv_synt.h @@ -0,0 +1,29 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + +#ifndef _UV_SYNT +#define _UV_SYNT + +void uv_synt_init(void); +void uv_synt(IMBE_PARAM *imbe_param, Word16 *snd); +void fft(Word16 *datam1, Word16 nn, Word16 isign); + +#endif diff --git a/imbe_vocoder/src/lib/v_synt.cc b/imbe_vocoder/src/lib/v_synt.cc new file mode 100644 index 0000000..9597e95 --- /dev/null +++ b/imbe_vocoder/src/lib/v_synt.cc @@ -0,0 +1,248 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + + +#include "typedef.h" +#include "basic_op.h" +#include "imbe.h" +#include "aux_sub.h" +#include "dsp_sub.h" +#include "math_sub.h" +#include "v_synt.h" +#include "rand_gen.h" +#include "tbls.h" +#include "encode.h" +#include "op25_imbe_vocoder.h" + + + + + + +#define CNST_0_1_Q1_15 0x0CCD + + + +void op25_imbe_vocoder::v_synt_init(void) +{ + Word16 i; + + for(i = 0; i < NUM_HARMS_MAX; i++) + { + ph_mem[i] = L_deposit_h(rand_gen()); + vu_dsn_prev[i] = 0; + } + + num_harms_prev3 = 0; + fund_freq_prev = 0; +} + + +void op25_imbe_vocoder::v_synt(IMBE_PARAM *imbe_param, Word16 *snd) +{ + Word32 L_tmp, L_tmp1, fund_freq, L_snd[FRAME], L_ph_acc, L_ph_step; + Word32 L_ph_acc_aux, L_ph_step_prev, L_amp_acc, L_amp_step, L_ph_step_aux; + Word16 num_harms, i, j, *vu_dsn, *sa, *s_ptr, *s_ptr_aux, num_harms_max, num_harms_max_4; + UWord32 ph_mem_prev[NUM_HARMS_MAX], dph[NUM_HARMS_MAX]; + Word16 num_harms_inv, num_harms_sh, num_uv; + Word16 freq_flag; + + + fund_freq = imbe_param->fund_freq; + num_harms = imbe_param->num_harms; + vu_dsn = imbe_param->v_uv_dsn; + sa = imbe_param->sa; + num_harms_inv = imbe_param->div_one_by_num_harm; + num_harms_sh = imbe_param->div_one_by_num_harm_sh; + num_uv = imbe_param->l_uv; + + for(i = 0; i < FRAME; i++) + L_snd[i] = 0; + + // Update phases (calculated phase value correspond to bound of frame) + L_tmp = (((fund_freq_prev + fund_freq) >> 7) * FRAME/2) << 7; // It is performed integer multiplication by mod 1 + + L_ph_acc = 0; + for(i = 0; i < NUM_HARMS_MAX; i++) + { + ph_mem_prev[i] = ph_mem[i]; + L_ph_acc += L_tmp; + ph_mem[i] += L_ph_acc; + dph[i] = 0; + } + + num_harms_max = (num_harms >= num_harms_prev3)?num_harms:num_harms_prev3; + num_harms_max_4 = num_harms_max >> 2; + + if(L_abs(L_sub(fund_freq, fund_freq_prev)) >= L_mpy_ls(fund_freq, CNST_0_1_Q1_15)) + freq_flag = 1; + else + freq_flag = 0; + + L_ph_step = L_ph_step_prev = 0; + for(i = 0; i < num_harms_max; i++) + { + L_ph_step += fund_freq; + L_ph_step_prev += fund_freq_prev; + + + if(i > num_harms_max_4) + { + if(num_uv == num_harms) + { + dph[i] = L_deposit_h(rand_gen()); + } + else + { + L_tmp = L_mult(rand_gen(), num_harms_inv); + dph[i] = L_shr(L_tmp, 15 - num_harms_sh) * num_uv; + } + ph_mem[i] += dph[i]; + } + + if(vu_dsn[i] == 0 && vu_dsn_prev[i] == 0) + continue; + + if(vu_dsn[i] == 1 && vu_dsn_prev[i] == 0) // unvoiced => voiced + { + s_ptr = (Word16 *)ws; + L_ph_acc = ph_mem[i] - (((L_ph_step >> 7) * 104) << 7); + for(j = 56; j <= 104; j++) + { + L_tmp = L_mult(*s_ptr++, sa[i]); + L_tmp = L_mpy_ls(L_tmp, cos_fxp(extract_h(L_ph_acc))); + L_tmp = L_shr(L_tmp, 1); + L_snd[j] = L_add(L_snd[j], L_tmp); + L_ph_acc += L_ph_step; + } + + for(j = 105; j <= 159; j++) + { + L_tmp = L_mult(sa[i], cos_fxp(extract_h(L_ph_acc))); + L_tmp = L_shr(L_tmp, 1); + L_snd[j] = L_add(L_snd[j], L_tmp); + L_ph_acc += L_ph_step; + } + continue; + } + + + if(vu_dsn[i] == 0 && vu_dsn_prev[i] == 1) // voiced => unvoiced + { + s_ptr = (Word16 *)&ws[48]; + L_ph_acc = ph_mem_prev[i]; + + for(j = 0; j <= 55; j++) + { + L_tmp = L_mult(sa_prev3[i], cos_fxp(extract_h(L_ph_acc))); + L_tmp = L_shr(L_tmp, 1); + L_snd[j] = L_add(L_snd[j], L_tmp); + L_ph_acc += L_ph_step_prev; + } + + for(j = 56; j <= 104; j++) + { + L_tmp = L_mult(*s_ptr--, sa_prev3[i]); + L_tmp = L_mpy_ls(L_tmp, cos_fxp(extract_h(L_ph_acc))); + L_tmp = L_shr(L_tmp, 1); + L_snd[j] = L_add(L_snd[j], L_tmp); + L_ph_acc += L_ph_step_prev; + } + continue; + } + + if(i >=7 || freq_flag) + { + s_ptr_aux = (Word16 *)&ws[48]; + L_ph_acc_aux = ph_mem_prev[i]; + + s_ptr = (Word16 *)ws; + L_ph_acc = ph_mem[i] - (((L_ph_step >> 7) * 104) << 7); + + for(j = 0; j <= 55; j++) + { + L_tmp = L_mult(sa_prev3[i], cos_fxp(extract_h(L_ph_acc_aux))); + L_tmp = L_shr(L_tmp, 1); + L_snd[j] = L_add(L_snd[j], L_tmp); + L_ph_acc_aux += L_ph_step_prev; + } + + for(j = 56; j <= 104; j++) + { + L_tmp = L_mult(*s_ptr_aux--, sa_prev3[i]); + L_tmp = L_mpy_ls(L_tmp, cos_fxp(extract_h(L_ph_acc_aux))); + L_tmp = L_shr(L_tmp, 1); + L_snd[j] = L_add(L_snd[j], L_tmp); + + L_tmp = L_mult(*s_ptr++, sa[i]); + L_tmp = L_mpy_ls(L_tmp, cos_fxp(extract_h(L_ph_acc))); + L_tmp = L_shr(L_tmp, 1); + L_snd[j] = L_add(L_snd[j], L_tmp); + + L_ph_acc_aux += L_ph_step_prev; + L_ph_acc += L_ph_step; + } + + for(j = 105; j <= 159; j++) + { + L_tmp = L_mult(sa[i], cos_fxp(extract_h(L_ph_acc))); + L_tmp = L_shr(L_tmp, 1); + L_snd[j] = L_add(L_snd[j], L_tmp); + L_ph_acc += L_ph_step; + } + continue; + } + + L_amp_step = L_mpy_ls(L_shr(L_deposit_h(sub(sa[i], sa_prev3[i])), 4 + 1), CNST_0_1_Q1_15); // (sa[i] - sa_prev3[i]) / 160, 1/160 = 0.1/16 + L_amp_acc = L_shr(L_deposit_h(sa_prev3[i]), 1); + + + L_ph_step_aux = L_mpy_ls(L_shr(fund_freq - fund_freq_prev, 4 + 1), CNST_0_1_Q1_15); // (fund_freq - fund_freq_prev)/(2*160) + L_ph_step_aux = ((L_ph_step_aux >> 7) * (i + 1)) << 7; + + L_ph_acc = ph_mem_prev[i]; + + L_tmp1 = L_mpy_ls(L_shr(dph[i], 4), CNST_0_1_Q1_15); // dph[i] / 160 + + for(j = 0; j < 160; j++) + { + L_ph_acc_aux = ((L_ph_step_aux >> 9) * j) << 9; + L_ph_acc_aux = ((L_ph_acc_aux >> 9) * j) << 9; + + L_tmp = L_mpy_ls(L_amp_acc, cos_fxp(extract_h(L_ph_acc + L_ph_acc_aux))); + L_snd[j] = L_add(L_snd[j], L_tmp); + + L_amp_acc = L_add(L_amp_acc, L_amp_step); + L_ph_acc += L_ph_step_prev; + L_ph_acc += L_tmp1; + } + } + + for(i = 0; i < FRAME; i++) + *snd++ = extract_h(L_snd[i]); + + v_zap(vu_dsn_prev, NUM_HARMS_MAX); + v_equ(vu_dsn_prev, imbe_param->v_uv_dsn, num_harms); + v_equ(sa_prev3, imbe_param->sa, num_harms); + + num_harms_prev3 = num_harms; + fund_freq_prev = fund_freq; +} diff --git a/imbe_vocoder/src/lib/v_synt.h b/imbe_vocoder/src/lib/v_synt.h new file mode 100644 index 0000000..2139fb2 --- /dev/null +++ b/imbe_vocoder/src/lib/v_synt.h @@ -0,0 +1,30 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + + +#ifndef _V_SYNT +#define _V_SYNT + +void v_synt_init(void); +void v_synt(IMBE_PARAM *imbe_param, Word16 *snd); + + +#endif diff --git a/imbe_vocoder/src/lib/v_uv_det.cc b/imbe_vocoder/src/lib/v_uv_det.cc new file mode 100644 index 0000000..101f5b8 --- /dev/null +++ b/imbe_vocoder/src/lib/v_uv_det.cc @@ -0,0 +1,373 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + + +#include "typedef.h" +#include "globals.h" +#include "imbe.h" +#include "basic_op.h" +#include "aux_sub.h" +#include "math_sub.h" +#include "dsp_sub.h" +#include "tbls.h" +#include "v_uv_det.h" + +#include +#include +#include +#include "encode.h" +#include "op25_imbe_vocoder.h" + + +#define CNST_0_5625_Q1_15 0x4800 +#define CNST_0_45_Q1_15 0x3999 +#define CNST_0_1741_Q1_15 0x164A +#define CNST_0_1393_Q1_15 0x11D5 +#define CNST_0_99_Q1_15 0x7EB8 +#define CNST_0_01_Q1_15 0x0148 +#define CNST_0_0025_Q1_15 0x0051 +#define CNST_0_25_Q1_15 0x2000 +#define CNST_PI_4_Q1_15 0x6488 +#define CNST_0_55_Q4_12 0x08CD + + + + + + + +extern FILE *fp_in, *fp_out; +extern int frame_cnt; + + +void op25_imbe_vocoder::pitch_ref_init(void) +{ + v_zap(v_uv_dsn, NUM_BANDS_MAX); + th_max = 0; +} + +Word16 op25_imbe_vocoder::voiced_sa_calc(Word32 num, Word16 den) +{ + Word16 tmp; + Word32 L_tmp; + + L_tmp = L_mpy_ls(num, den); + L_tmp = sqrt_l_exp(L_tmp, &tmp); + L_tmp = L_shr(L_tmp, tmp - 3); + + //L_tmp =0; + //return (Word16)(2*256.0*sqrt(2*(double)num/(double)den)); + return extract_h(L_tmp); +} + +Word16 op25_imbe_vocoder::unvoiced_sa_calc(Word32 num, Word16 den) +{ + Word16 shift, tmp; + Word32 L_tmp; + + shift = norm_s(den); + tmp = div_s(0x4000, shl(den, shift)); + L_tmp = L_shl(L_mpy_ls(num, tmp), shift + 2); + L_tmp = sqrt_l_exp(L_tmp, &tmp); + L_tmp = L_shr(L_tmp, tmp - 2 + 6); + L_tmp = L_mpy_ls(L_tmp, 0x4A76); + + //L_tmp =0; + //return (Word16)(2*0.1454 * sqrt(2*256*(double)num/(double)den)); + return extract_h(L_tmp); +} + +//============================================================================= +// +// Voiced/Unvoiced Determination & Spectral Amplitudes Estimation +// +//============================================================================= +void op25_imbe_vocoder::v_uv_det(IMBE_PARAM *imbe_param, Cmplx16 *fft_buf) +{ + Word16 i, j, index_a_save, tmp, index_wr; + Word32 fund_freq, fund_freq_2, fund_freq_acc_a, fund_freq_acc_b, fund_freq_acc, fund_fr_acc, L_tmp, amp_re_acc, amp_im_acc; + Word16 ha, hb, index_a, index_b, index_tbl[30], it_ind, re_tmp, im_tmp, re_tmp2, im_tmp2, sc_coef; + Word32 Sw_sum, M_num[NUM_HARMS_MAX], M_num_sum, M_den_sum, D_num, D_den, th_lf, th_hf, th0, fund_fr_step, M_fcn_num, M_fcn_den; + Word16 sp_rec_re, sp_rec_im, M_fcn; + Word16 band_cnt, num_harms_cnt, uv_harms_cnt, Dk; + Word16 num_harms, num_bands, dsn_thr=0; + Word16 thr[NUM_BANDS_MAX], M_den[NUM_HARMS_MAX], b1_vec; + + + fund_freq = imbe_param->fund_freq; + + tmp = shr( add( shr(imbe_param->ref_pitch, 1), CNST_0_25_Q8_8), 8); // fix(pitch_cand / 2 + 0.5) + num_harms = extract_h((UWord32)CNST_0_9254_Q0_16 * tmp); // fix(0.9254 * fix(pitch_cand / 2 + 0.5)) + if(num_harms < NUM_HARMS_MIN) + num_harms = NUM_HARMS_MIN; + else if(num_harms > NUM_HARMS_MAX) + num_harms = NUM_HARMS_MAX; + + if(num_harms <= 36) + num_bands = extract_h((UWord32)(num_harms + 2) * CNST_0_33_Q0_16); // fix((L+2)/3) + else + num_bands = NUM_BANDS_MAX; + + imbe_param->num_harms = num_harms; + imbe_param->num_bands = num_bands; + + //========================================================================= + // + // M(th) function calculation + // + //========================================================================= + for(j = 0, th_lf = 0; j < 64; j++) + { + th_lf = L_mac(th_lf, fft_buf[j].re, fft_buf[j].re); + th_lf = L_mac(th_lf, fft_buf[j].im, fft_buf[j].im); + } + for(j = 64, th_hf = 0; j < 128; j++) + { + th_hf = L_mac(th_hf, fft_buf[j].re, fft_buf[j].re); + th_hf = L_mac(th_hf, fft_buf[j].im, fft_buf[j].im); + } + th0 = L_add(th_lf, th_hf); + + if(th0 > th_max) + th_max = L_shr(L_add(th_max, th0), 1); + else + th_max = L_add(L_mpy_ls(th_max, CNST_0_99_Q1_15), L_mpy_ls(th0, CNST_0_01_Q1_15)); + + M_fcn_num = L_add(th0, L_mpy_ls(th_max, CNST_0_0025_Q1_15)); + M_fcn_den = L_add(th0, L_mpy_ls(th_max, CNST_0_01_Q1_15)); + if(M_fcn_den == 0) + M_fcn = CNST_0_25_Q1_15; + else + { + tmp = norm_l(M_fcn_den); + M_fcn_den = L_shl(M_fcn_den, tmp); + M_fcn_num = L_shl(M_fcn_num, tmp); + + M_fcn = div_s(extract_h(M_fcn_num), extract_h(M_fcn_den)); + + if(th_lf < (L_tmp= L_add(L_shl(th_hf, 2), th_hf))) // compare th_lf < 5*th_hf + { + tmp = norm_l(L_tmp); + M_fcn_den = L_shl(L_tmp, tmp); + th_lf = L_shl(th_lf, tmp); + + tmp = div_s(extract_h(th_lf), extract_h(M_fcn_den)); + L_tmp = sqrt_l_exp(L_deposit_h(tmp), &tmp); + if(tmp) + L_tmp = L_shr(L_tmp, tmp); + M_fcn = mult(M_fcn, extract_h(L_tmp)); + } + } + // ======================================================================== + fund_fr_step = L_shl(L_mpy_ls(fund_freq, CNST_PI_4_Q1_15), 2); // mult by PI + + uv_harms_cnt = 0; + b1_vec = 0; + band_cnt = 0; + num_harms_cnt = 0; + Sw_sum = 0; + D_num = D_den = 0; + + fund_fr_acc = 0; + fund_freq_acc = fund_freq; + fund_freq_2 = L_shr(fund_freq, 1); + fund_freq_acc_a = L_sub(fund_freq, fund_freq_2); + fund_freq_acc_b = L_add(fund_freq, fund_freq_2); + for(j = 0; j < num_harms; j++) + { + ha = extract_h(fund_freq_acc_a); + hb = extract_h(fund_freq_acc_b); + index_a = (ha >> 8) + ((ha & 0xFF)?1:0); + index_b = (hb >> 8) + ((hb & 0xFF)?1:0); + + L_tmp = L_shl(L_deposit_h(index_a), 8); + L_tmp = L_sub(L_tmp, fund_freq_acc); + L_tmp = L_add(L_tmp, 0x00020000); // for rounding purpose + L_tmp = L_shr(L_tmp, 2); + + index_a_save = index_a; + it_ind = 0; + + // =========== v/uv determination threshold function == + if(num_harms_cnt == 0) // calculate one time per band + { + if(imbe_param->e_p > CNST_0_55_Q4_12 && band_cnt >= 1) + dsn_thr = 0; + else if(v_uv_dsn[band_cnt] == 1) + dsn_thr = mult(M_fcn, sub(CNST_0_5625_Q1_15, mult(CNST_0_1741_Q1_15, extract_h(fund_fr_acc)))); + else + dsn_thr = mult(M_fcn, sub(CNST_0_45_Q1_15, mult(CNST_0_1393_Q1_15, extract_h(fund_fr_acc)))); + + fund_fr_acc = L_add(fund_fr_acc, fund_fr_step); + + thr[band_cnt] = dsn_thr; + } + // ==================================================== + + M_den_sum = 0; + amp_re_acc = amp_im_acc = 0; + while(index_a < index_b) + { + index_wr = extract_h(L_tmp); + if(index_wr < 0 && (L_tmp & 0xFFFF)) // truncating for negative number + index_wr = add(index_wr, 1); + index_wr = add(index_wr, 160); + index_tbl[it_ind++] = index_wr; + if(index_wr >= 0 && index_wr <= 320) + { + amp_re_acc = L_mac(amp_re_acc, fft_buf[index_a].re, wr_sp[index_wr]); + amp_im_acc = L_mac(amp_im_acc, fft_buf[index_a].im, wr_sp[index_wr]); + M_den_sum = L_add(M_den_sum, mult(wr_sp[index_wr], wr_sp[index_wr])); + } + + index_a++; + L_tmp = L_add(L_tmp, 0x400000); + } + sc_coef = div_s(0x4000, extract_l(L_shr(M_den_sum, 1))); + im_tmp2 = mult(extract_h(amp_im_acc), sc_coef); + re_tmp2 = mult(extract_h(amp_re_acc), sc_coef); + + M_num_sum = 0; + it_ind = 0; + index_a = index_a_save; + while(index_a < index_b) + { + index_wr = index_tbl[it_ind++]; + if(index_wr < 0 || index_wr > 320) + sp_rec_re = sp_rec_im = 0; + else + { + sp_rec_im = mult( im_tmp2, wr_sp[index_wr]); + sp_rec_re = mult( re_tmp2, wr_sp[index_wr]); + } + + re_tmp = sub(fft_buf[index_a].re, sp_rec_re); + im_tmp = sub(fft_buf[index_a].im, sp_rec_im); + D_num = L_mac(D_num, re_tmp, re_tmp); + D_num = L_mac(D_num, im_tmp, im_tmp); + + M_num_sum = L_mac(M_num_sum, fft_buf[index_a].re, fft_buf[index_a].re); + M_num_sum = L_mac(M_num_sum, fft_buf[index_a].im, fft_buf[index_a].im); + + index_a++; + } + + M_den[j] = sc_coef; + M_num[j] = M_num_sum; + D_den = L_add(D_den, M_num_sum); + + if(++num_harms_cnt == 3 && band_cnt < num_bands - 1) + { + b1_vec <<= 1; + + if(D_den > D_num && D_den != 0) + { + tmp = norm_l(D_den); + Dk = div_s(extract_h(L_shl(D_num, tmp)), extract_h(L_shl(D_den, tmp))); + } + else + Dk = MAX_16; + + if(Dk < dsn_thr) + { + // voiced band + v_uv_dsn[band_cnt] = 1; + b1_vec |= 1; + i = j - 2; + while(i <= j) + { + imbe_param->sa[i] = voiced_sa_calc(M_num[i], M_den[i]); + imbe_param->v_uv_dsn[i] = 1; + i++; + } + } + else + { + // unvoiced band + v_uv_dsn[band_cnt] = 0; + i = j - 2; + while(i <= j) + { + imbe_param->sa[i] = unvoiced_sa_calc(M_num[i], index_b - index_a_save); + imbe_param->v_uv_dsn[i] = 0; + uv_harms_cnt++; + i++; + } + } + + D_num = D_den = 0; + num_harms_cnt = 0; + band_cnt++; + } + + + fund_freq_acc_a = L_add(fund_freq_acc_a, fund_freq); + fund_freq_acc_b = L_add(fund_freq_acc_b, fund_freq); + fund_freq_acc = L_add(fund_freq_acc, fund_freq); + } + + if(num_harms_cnt) + { + b1_vec <<= 1; + if(D_den > D_num && D_den != 0) + { + tmp = norm_l(D_den); + Dk= div_s(extract_h(L_shl(D_num, tmp)), extract_h(L_shl(D_den, tmp))); + } + else + Dk = MAX_16; + + if(Dk < dsn_thr) + { + // voiced band + v_uv_dsn[band_cnt] = 1; + b1_vec |= 1; + + i = num_harms - num_harms_cnt; + while(i < num_harms) + { + imbe_param->sa[i] = voiced_sa_calc(M_num[i], M_den[i]); + imbe_param->v_uv_dsn[i] = 1; + i++; + } + } + else + { + // unvoiced band + v_uv_dsn[band_cnt] = 0; + i = num_harms - num_harms_cnt; + while(i < num_harms) + { + imbe_param->sa[i] = unvoiced_sa_calc(M_num[i], index_b - index_a_save); + imbe_param->v_uv_dsn[i] = 0; + uv_harms_cnt++; + i++; + } + } + } + + imbe_param->l_uv = uv_harms_cnt; + + + imbe_param->b_vec[1] = b1_vec; // Save encoded voiced/unvoiced decision + imbe_param->b_vec[0] = shr( sub(imbe_param->ref_pitch, 0x1380), 7); // Pitch encode fix(2*pitch - 39) + +} diff --git a/imbe_vocoder/src/lib/v_uv_det.h b/imbe_vocoder/src/lib/v_uv_det.h new file mode 100644 index 0000000..ebe270f --- /dev/null +++ b/imbe_vocoder/src/lib/v_uv_det.h @@ -0,0 +1,28 @@ +/* + * Project 25 IMBE Encoder/Decoder Fixed-Point implementation + * Developed by Pavel Yazev E-mail: pyazev@gmail.com + * Version 1.0 (c) Copyright 2009 + * + * This 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, or (at your option) + * any later version. + * + * The software is distributed in the hope that 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; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Boston, MA + * 02110-1301, USA. + */ + + +#ifndef _V_UV_DET +#define _V_UV_DET + +void v_uv_det(IMBE_PARAM *imbe_param, Cmplx16 *fft_buf); + +#endif diff --git a/imbe_vocoder/src/python/Makefile b/imbe_vocoder/src/python/Makefile new file mode 100644 index 0000000..e79d596 --- /dev/null +++ b/imbe_vocoder/src/python/Makefile @@ -0,0 +1,510 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# src/python/Makefile. Generated from Makefile.in by configure. + +# 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. + + + +# +# Copyright 2004 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# + +# -*- Makefile -*- +# +# Copyright 2004,2006 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# +srcdir = . +top_srcdir = ../.. + +pkgdatadir = $(datadir)/gr-op25_imbe +pkglibdir = $(libdir)/gr-op25_imbe +pkgincludedir = $(includedir)/gr-op25_imbe +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = /usr/bin/install -c +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 = i686-pc-linux-gnu +host_triplet = i686-pc-linux-gnu +target_triplet = i686-pc-linux-gnu +DIST_COMMON = $(noinst_PYTHON) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/run_tests.in \ + $(top_srcdir)/Makefile.common +subdir = src/python +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/config/acx_pthread.m4 \ + $(top_srcdir)/config/gr_as.m4 $(top_srcdir)/config/gr_boost.m4 \ + $(top_srcdir)/config/gr_gprof.m4 \ + $(top_srcdir)/config/gr_no_undefined.m4 \ + $(top_srcdir)/config/gr_omnithread.m4 \ + $(top_srcdir)/config/gr_pwin32.m4 \ + $(top_srcdir)/config/gr_python.m4 \ + $(top_srcdir)/config/gr_scripting.m4 \ + $(top_srcdir)/config/gr_swig.m4 \ + $(top_srcdir)/config/gr_x86_64.m4 \ + $(top_srcdir)/config/lf_cxx.m4 \ + $(top_srcdir)/config/lf_warnings.m4 \ + $(top_srcdir)/config/pkg.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = run_tests +SOURCES = +DIST_SOURCES = +py_compile = $(top_srcdir)/py-compile +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} /home/mhp/imbe_vocoder/missing --run aclocal-1.9 +AMDEP_FALSE = # +AMDEP_TRUE = +AMTAR = ${SHELL} /home/mhp/imbe_vocoder/missing --run tar +AR = ar +AS = as +AUTOCONF = ${SHELL} /home/mhp/imbe_vocoder/missing --run autoconf +AUTOHEADER = ${SHELL} /home/mhp/imbe_vocoder/missing --run autoheader +AUTOMAKE = ${SHELL} /home/mhp/imbe_vocoder/missing --run automake-1.9 +AWK = gawk +BOOST_CFLAGS = -I/usr/local/include/boost-1_37 +CC = gcc +CCAS = $(CC) +CCASFLAGS = $(CFLAGS) +CCDEPMODE = depmode=gcc3 +CFLAGS = -g -O2 -pthread +CPP = gcc -E +CPPFLAGS = +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O6 -Wall -Woverloaded-virtual -pthread +CXX_FOR_BUILD = g++ +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DLLTOOL = dlltool +ECHO = echo +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = grep -E +EXEEXT = +F77 = +FFLAGS = +GNURADIO_CORE_CFLAGS = -pthread -DOMNITHREAD_POSIX=1 -I/usr/local/include/boost-1_37 -I/usr/local/include/gnuradio -I/usr/local/include +GNURADIO_CORE_INCLUDEDIR = /usr/local/include/gnuradio +GNURADIO_CORE_LIBS = -L/usr/local/lib -lgnuradio-core -lboost_thread-gcc41-mt-1_37 -lrt -lboost_date_time-gcc41-mt-1_37 -lgruel -lfftw3f -lgsl -lgslcblas -lm -lgromnithread +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s +LDFLAGS = +LIBOBJS = +LIBS = -L/usr/local/lib -lgnuradio-core -lboost_thread-gcc41-mt-1_37 -lrt -lboost_date_time-gcc41-mt-1_37 -lgruel -lfftw3f -lgsl -lgslcblas -lm -lgromnithread +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LN_S = ln -s +LTLIBOBJS = +MAKEINFO = ${SHELL} /home/mhp/imbe_vocoder/missing --run makeinfo +NO_UNDEFINED = +OBJDUMP = objdump +OBJEXT = o +OMNITHREAD_NT_FALSE = +OMNITHREAD_NT_TRUE = # +OMNITHREAD_POSIX_FALSE = # +OMNITHREAD_POSIX_TRUE = +PACKAGE = gr-op25_imbe +PACKAGE_BUGREPORT = +PACKAGE_NAME = +PACKAGE_STRING = +PACKAGE_TARNAME = +PACKAGE_VERSION = +PATH_SEPARATOR = : +PKG_CONFIG = /usr/bin/pkg-config +PTHREAD_CC = gcc +PTHREAD_CFLAGS = -pthread +PTHREAD_LIBS = -lrt +PYTHON = /usr/bin/python +PYTHON_CPPFLAGS = -I/usr/include/python2.4 +PYTHON_EXEC_PREFIX = ${exec_prefix} +PYTHON_LDFLAGS = +PYTHON_PLATFORM = linux2 +PYTHON_PREFIX = ${prefix} +PYTHON_VERSION = 2.4 +RANLIB = ranlib +SED = /bin/sed +SET_MAKE = +SHELL = /bin/sh +STD_DEFINES_AND_INCLUDES = -pthread -DOMNITHREAD_POSIX=1 -I/usr/local/include/boost-1_37 -I/usr/local/include/gnuradio -I/usr/local/include -I/usr/local/include/boost-1_37 +STRIP = strip +SWIG = /usr/local/bin/swig -c++ +SWIG_PYTHON_CPPFLAGS = -I/usr/include/python2.4 +SWIG_PYTHON_LIB = -lswigpy +SWIG_PYTHON_OPT = -python +VERSION = 0.1 +ac_ct_AR = ar +ac_ct_AS = +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_DLLTOOL = +ac_ct_F77 = +ac_ct_OBJDUMP = +ac_ct_RANLIB = ranlib +ac_ct_STRIP = strip +am__fastdepCC_FALSE = # +am__fastdepCC_TRUE = +am__fastdepCXX_FALSE = # +am__fastdepCXX_TRUE = +am__include = include +am__leading_dot = . +am__quote = +am__tar = ${AMTAR} chof - "$$tardir" +am__untar = ${AMTAR} xf - +bindir = ${exec_prefix}/bin +build = i686-pc-linux-gnu +build_alias = +build_cpu = i686 +build_os = linux-gnu +build_vendor = pc +datadir = ${prefix}/share +exec_prefix = ${prefix} +host = i686-pc-linux-gnu +host_alias = +host_cpu = i686 +host_os = linux-gnu +host_vendor = pc +includedir = ${prefix}/include +infodir = ${prefix}/info +install_sh = /home/mhp/imbe_vocoder/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localstatedir = ${prefix}/var +mandir = ${prefix}/man +mkdir_p = mkdir -p -- +oldincludedir = /usr/include +pkgpyexecdir = ${pyexecdir}/gr-op25_imbe +pkgpythondir = ${pythondir}/gr-op25_imbe +prefix = /usr +program_transform_name = s,x,x, +pyexecdir = ${exec_prefix}/lib/python2.4/site-packages +pythondir = ${prefix}/lib/python2.4/site-packages +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +sysconfdir = ${prefix}/etc +target = i686-pc-linux-gnu +target_alias = +target_cpu = i686 +target_os = linux-gnu +target_vendor = pc + +# includes +grincludedir = $(includedir)/gnuradio + +# swig includes +swigincludedir = $(grincludedir)/swig + +# Install this stuff in the appropriate subdirectory +# This usually ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio +grpythondir = $(pythondir)/gnuradio +grpyexecdir = $(pyexecdir)/gnuradio + +# swig flags +SWIGPYTHONFLAGS = -fvirtual -python -modern +SWIGGRFLAGS = -I$(GNURADIO_CORE_INCLUDEDIR)/swig -I$(GNURADIO_CORE_INCLUDEDIR) +EXTRA_DIST = run_tests.in +TESTS = \ + run_tests + +noinst_PYTHON = \ + qa_howto.py + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(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/python/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/python/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 +run_tests: $(top_builddir)/config.status $(srcdir)/run_tests.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: + + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list='$(TESTS)'; \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *" $$tst "*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + echo "XPASS: $$tst"; \ + ;; \ + *) \ + echo "PASS: $$tst"; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *" $$tst "*) \ + xfail=`expr $$xfail + 1`; \ + echo "XFAIL: $$tst"; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + echo "FAIL: $$tst"; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + echo "SKIP: $$tst"; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all tests failed"; \ + else \ + banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + skipped="($$skip tests were not run)"; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + $(mkdir_p) $(distdir)/../.. + @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 + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +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." +clean: clean-am + +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-TESTS 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 + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/imbe_vocoder/src/python/Makefile.am b/imbe_vocoder/src/python/Makefile.am new file mode 100644 index 0000000..c06f34e --- /dev/null +++ b/imbe_vocoder/src/python/Makefile.am @@ -0,0 +1,32 @@ +# +# Copyright 2004 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# + +include $(top_srcdir)/Makefile.common + +EXTRA_DIST = run_tests.in + + +TESTS = \ + run_tests + + +noinst_PYTHON = \ + qa_howto.py diff --git a/imbe_vocoder/src/python/Makefile.in b/imbe_vocoder/src/python/Makefile.in new file mode 100644 index 0000000..6243f4a --- /dev/null +++ b/imbe_vocoder/src/python/Makefile.in @@ -0,0 +1,510 @@ +# 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@ + +# +# Copyright 2004 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# + +# -*- Makefile -*- +# +# Copyright 2004,2006 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# +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@ +target_triplet = @target@ +DIST_COMMON = $(noinst_PYTHON) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/run_tests.in \ + $(top_srcdir)/Makefile.common +subdir = src/python +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/config/acx_pthread.m4 \ + $(top_srcdir)/config/gr_as.m4 $(top_srcdir)/config/gr_boost.m4 \ + $(top_srcdir)/config/gr_gprof.m4 \ + $(top_srcdir)/config/gr_no_undefined.m4 \ + $(top_srcdir)/config/gr_omnithread.m4 \ + $(top_srcdir)/config/gr_pwin32.m4 \ + $(top_srcdir)/config/gr_python.m4 \ + $(top_srcdir)/config/gr_scripting.m4 \ + $(top_srcdir)/config/gr_swig.m4 \ + $(top_srcdir)/config/gr_x86_64.m4 \ + $(top_srcdir)/config/lf_cxx.m4 \ + $(top_srcdir)/config/lf_warnings.m4 \ + $(top_srcdir)/config/pkg.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = run_tests +SOURCES = +DIST_SOURCES = +py_compile = $(top_srcdir)/py-compile +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BOOST_CFLAGS = @BOOST_CFLAGS@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CXX_FOR_BUILD = @CXX_FOR_BUILD@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GNURADIO_CORE_CFLAGS = @GNURADIO_CORE_CFLAGS@ +GNURADIO_CORE_INCLUDEDIR = @GNURADIO_CORE_INCLUDEDIR@ +GNURADIO_CORE_LIBS = @GNURADIO_CORE_LIBS@ +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@ +NO_UNDEFINED = @NO_UNDEFINED@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OMNITHREAD_NT_FALSE = @OMNITHREAD_NT_FALSE@ +OMNITHREAD_NT_TRUE = @OMNITHREAD_NT_TRUE@ +OMNITHREAD_POSIX_FALSE = @OMNITHREAD_POSIX_FALSE@ +OMNITHREAD_POSIX_TRUE = @OMNITHREAD_POSIX_TRUE@ +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@ +PKG_CONFIG = @PKG_CONFIG@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STD_DEFINES_AND_INCLUDES = @STD_DEFINES_AND_INCLUDES@ +STRIP = @STRIP@ +SWIG = @SWIG@ +SWIG_PYTHON_CPPFLAGS = @SWIG_PYTHON_CPPFLAGS@ +SWIG_PYTHON_LIB = @SWIG_PYTHON_LIB@ +SWIG_PYTHON_OPT = @SWIG_PYTHON_OPT@ +VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_AS = @ac_ct_AS@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_OBJDUMP = @ac_ct_OBJDUMP@ +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@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ + +# includes +grincludedir = $(includedir)/gnuradio + +# swig includes +swigincludedir = $(grincludedir)/swig + +# Install this stuff in the appropriate subdirectory +# This usually ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio +grpythondir = $(pythondir)/gnuradio +grpyexecdir = $(pyexecdir)/gnuradio + +# swig flags +SWIGPYTHONFLAGS = -fvirtual -python -modern +SWIGGRFLAGS = -I$(GNURADIO_CORE_INCLUDEDIR)/swig -I$(GNURADIO_CORE_INCLUDEDIR) +EXTRA_DIST = run_tests.in +TESTS = \ + run_tests + +noinst_PYTHON = \ + qa_howto.py + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(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/python/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/python/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 +run_tests: $(top_builddir)/config.status $(srcdir)/run_tests.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: + + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list='$(TESTS)'; \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *" $$tst "*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + echo "XPASS: $$tst"; \ + ;; \ + *) \ + echo "PASS: $$tst"; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *" $$tst "*) \ + xfail=`expr $$xfail + 1`; \ + echo "XFAIL: $$tst"; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + echo "FAIL: $$tst"; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + echo "SKIP: $$tst"; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all tests failed"; \ + else \ + banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + skipped="($$skip tests were not run)"; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + $(mkdir_p) $(distdir)/../.. + @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 + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +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." +clean: clean-am + +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-TESTS 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 + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/imbe_vocoder/src/python/qa_op25_imbe.py b/imbe_vocoder/src/python/qa_op25_imbe.py new file mode 100755 index 0000000..50dbfaa --- /dev/null +++ b/imbe_vocoder/src/python/qa_op25_imbe.py @@ -0,0 +1,3 @@ +#!/usr/bin/python + +print "FIXME" diff --git a/imbe_vocoder/src/python/run_tests b/imbe_vocoder/src/python/run_tests new file mode 100755 index 0000000..e7d45e5 --- /dev/null +++ b/imbe_vocoder/src/python/run_tests @@ -0,0 +1,50 @@ +#!/bin/sh + +# All this strange PYTHONPATH manipulation is required to run our +# tests using our just built shared library and swig-generated python +# code prior to installation. + +# build tree == src tree unless you're doing a VPATH build. +# If you don't know what a VPATH build is, you're not doing one. Relax... + +prefix=/usr +exec_prefix=${prefix} + +# Where to look in the build tree for our shared library +libbld=/home/mhp/imbe_vocoder/src/python/../.././src/lib +# Where to look in the src tree for swig generated python code +libsrc=/home/mhp/imbe_vocoder/src/python/../../src/lib +# Where to look in the src tree for hand written python code +py=/home/mhp/imbe_vocoder/src/python/../../src/python + +# Where to look for installed GNU Radio python modules +# FIXME this is wrong on a distcheck. We really need to ask gnuradio-core +# where it put its python files. +installed_pythondir=${prefix}/lib/python2.4/site-packages +installed_pyexecdir=${exec_prefix}/lib/python2.4/site-packages + +PYTHONPATH="$libbld:$libbld/.libs:$libsrc:$py:$installed_pythondir:$installed_pyexecdir:$PYTHONPATH" +#PYTHONPATH="$libbld:$libbld/.libs:$libsrc:$py:$installed_pythondir:$installed_pyexecdir" + +export PYTHONPATH + +# +# This is the simple part... +# Run everything that matches qa_*.py and return the final result. +# + +ok=yes +for file in ./qa_*.py +do + if ! $file + then + ok=no + fi +done + +if [ $ok = yes ] +then + exit 0 +else + exit 1 +fi diff --git a/imbe_vocoder/src/python/run_tests.in b/imbe_vocoder/src/python/run_tests.in new file mode 100644 index 0000000..6e4b83e --- /dev/null +++ b/imbe_vocoder/src/python/run_tests.in @@ -0,0 +1,50 @@ +#!/bin/sh + +# All this strange PYTHONPATH manipulation is required to run our +# tests using our just built shared library and swig-generated python +# code prior to installation. + +# build tree == src tree unless you're doing a VPATH build. +# If you don't know what a VPATH build is, you're not doing one. Relax... + +prefix=@prefix@ +exec_prefix=@exec_prefix@ + +# Where to look in the build tree for our shared library +libbld=@abs_top_builddir@/src/lib +# Where to look in the src tree for swig generated python code +libsrc=@abs_top_srcdir@/src/lib +# Where to look in the src tree for hand written python code +py=@abs_top_srcdir@/src/python + +# Where to look for installed GNU Radio python modules +# FIXME this is wrong on a distcheck. We really need to ask gnuradio-core +# where it put its python files. +installed_pythondir=@pythondir@ +installed_pyexecdir=@pyexecdir@ + +PYTHONPATH="$libbld:$libbld/.libs:$libsrc:$py:$installed_pythondir:$installed_pyexecdir:$PYTHONPATH" +#PYTHONPATH="$libbld:$libbld/.libs:$libsrc:$py:$installed_pythondir:$installed_pyexecdir" + +export PYTHONPATH + +# +# This is the simple part... +# Run everything that matches qa_*.py and return the final result. +# + +ok=yes +for file in @srcdir@/qa_*.py +do + if ! $file + then + ok=no + fi +done + +if [ $ok = yes ] +then + exit 0 +else + exit 1 +fi