FS-10509: [Build-System] Move broadvoice from tree to download on windows.
This commit is contained in:
parent
03cc850c68
commit
5dabf58f7b
|
@ -251,3 +251,4 @@ libs/lua-*/
|
|||
|
||||
libs/g722_1-*/
|
||||
libs/ilbc-*/
|
||||
libs/broadvoice-*/
|
||||
|
|
|
@ -430,7 +430,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_say_ru", "src\mod\say\m
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_valet_parking", "src\mod\applications\mod_valet_parking\mod_valet_parking.2015.vcxproj", "{432DB165-1EB2-4781-A9C0-71E62610B20A}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbroadvoice", "libs\broadvoice\src\libbroadvoice.2015.vcxproj", "{CF70F278-3364-4395-A2E1-23501C9B8AD2}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbroadvoice", "libs\win32\broadvoice\libbroadvoice.2015.vcxproj", "{CF70F278-3364-4395-A2E1-23501C9B8AD2}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_bv", "src\mod\codecs\mod_bv\mod_bv.2015.vcxproj", "{D5C87B19-150D-4EF3-A671-96589BD2D14A}"
|
||||
EndProject
|
||||
|
@ -657,6 +657,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download g722_1", "libs\win
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download iLBC", "libs\win32\Download iLBC.2015.vcxproj", "{53AADA60-DF12-46FF-BF94-566BBF849336}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download broadvoice", "libs\win32\Download broadvoice.2015.vcxproj", "{46502007-0D94-47AC-A640-C2B5EEA98333}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
All|Win32 = All|Win32
|
||||
|
@ -2963,6 +2965,18 @@ Global
|
|||
{53AADA60-DF12-46FF-BF94-566BBF849336}.Release|Win32.Build.0 = Release|Win32
|
||||
{53AADA60-DF12-46FF-BF94-566BBF849336}.Release|x64.ActiveCfg = Release|Win32
|
||||
{53AADA60-DF12-46FF-BF94-566BBF849336}.Release|x64.Build.0 = Release|Win32
|
||||
{46502007-0D94-47AC-A640-C2B5EEA98333}.All|Win32.ActiveCfg = Release|Win32
|
||||
{46502007-0D94-47AC-A640-C2B5EEA98333}.All|Win32.Build.0 = Release|Win32
|
||||
{46502007-0D94-47AC-A640-C2B5EEA98333}.All|x64.ActiveCfg = Release|Win32
|
||||
{46502007-0D94-47AC-A640-C2B5EEA98333}.All|x64.Build.0 = Release|Win32
|
||||
{46502007-0D94-47AC-A640-C2B5EEA98333}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{46502007-0D94-47AC-A640-C2B5EEA98333}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{46502007-0D94-47AC-A640-C2B5EEA98333}.Debug|x64.ActiveCfg = Debug|Win32
|
||||
{46502007-0D94-47AC-A640-C2B5EEA98333}.Debug|x64.Build.0 = Debug|Win32
|
||||
{46502007-0D94-47AC-A640-C2B5EEA98333}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{46502007-0D94-47AC-A640-C2B5EEA98333}.Release|Win32.Build.0 = Release|Win32
|
||||
{46502007-0D94-47AC-A640-C2B5EEA98333}.Release|x64.ActiveCfg = Release|Win32
|
||||
{46502007-0D94-47AC-A640-C2B5EEA98333}.Release|x64.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -3198,5 +3212,6 @@ Global
|
|||
{45CD36EE-0AF3-4387-8790-4F11E928299D} = {C120A020-773F-4EA3-923F-B67AF28B750D}
|
||||
{36603FE1-253F-4C2C-AAB6-12927A626135} = {C120A020-773F-4EA3-923F-B67AF28B750D}
|
||||
{53AADA60-DF12-46FF-BF94-566BBF849336} = {C120A020-773F-4EA3-923F-B67AF28B750D}
|
||||
{46502007-0D94-47AC-A640-C2B5EEA98333} = {C120A020-773F-4EA3-923F-B67AF28B750D}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Fri Nov 20 13:35:04 CST 2009
|
|
@ -1,2 +0,0 @@
|
|||
Adapted by Steve Underwood <steveu@coppice.org> from the source code
|
||||
supplied by Broadcom.
|
|
@ -1,507 +0,0 @@
|
|||
The broadvoice library is licenced under LGPL 2.1.The full text of this licence
|
||||
may be found below.
|
||||
|
||||
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
|
@ -1,3 +0,0 @@
|
|||
20.09.14 - 0.0.1 - Steve Underwood <steveu@coppice.org>
|
||||
- The first version.
|
||||
|
|
@ -1,182 +0,0 @@
|
|||
Basic Installation
|
||||
==================
|
||||
|
||||
These are generic installation instructions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, a file
|
||||
`config.cache' that saves the results of its tests to speed up
|
||||
reconfiguring, and a file `config.log' containing compiler output
|
||||
(useful mainly for debugging `configure').
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If at some point `config.cache'
|
||||
contains results you don't want to keep, you may remove or edit it.
|
||||
|
||||
The file `configure.ac' is used to create `configure' by a program
|
||||
called `autoconf'. You only need `configure.ac' if you want to change
|
||||
it or regenerate `configure' using a newer version of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
|
||||
Running `configure' takes awhile. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
5. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. You can give `configure'
|
||||
initial values for variables by setting them in the environment. Using
|
||||
a Bourne-compatible shell, you can do that on the command line like
|
||||
this:
|
||||
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
|
||||
|
||||
Or on systems that have the `env' program, you can do it like this:
|
||||
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
If you have to use a `make' that does not supports the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a time
|
||||
in the source code directory. After you have installed the package for
|
||||
one architecture, use `make distclean' before reconfiguring for another
|
||||
architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=PATH' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' can not figure out
|
||||
automatically, but needs to determine by the type of host the package
|
||||
will run on. Usually `configure' can figure that out, but if it prints
|
||||
a message saying it can not guess the host type, give it the
|
||||
`--host=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name with three fields:
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the host type.
|
||||
|
||||
If you are building compiler tools for cross-compiling, you can also
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for and the `--build=TYPE' option to select the type of
|
||||
system on which you are compiling the package.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Operation Controls
|
||||
==================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Use and save the results of the tests in FILE instead of
|
||||
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
|
||||
debugging `configure'.
|
||||
|
||||
`--help'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to `/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`--version'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options.
|
|
@ -1,81 +0,0 @@
|
|||
##
|
||||
## broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
##
|
||||
## Makefile.am -- Process this file with automake to produce Makefile.in
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the Lesser GNU General Public License version 2.1, as
|
||||
## published by the Free Software Foundation.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
##
|
||||
## $Id: Makefile.am,v 1.2 2009/11/21 17:19:22 steveu Exp $
|
||||
|
||||
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
|
||||
AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
|
||||
|
||||
noinst_SCRIPTS = broadvoice.spec
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
EXTRA_DIST = autogen.sh \
|
||||
broadvoice.pc \
|
||||
broadvoice.spec \
|
||||
wrapper.xsl \
|
||||
doc/broadvoice-doxygen \
|
||||
debian/changelog \
|
||||
debian/compat \
|
||||
debian/control \
|
||||
debian/copyright \
|
||||
debian/libbroadvoice1.install \
|
||||
debian/libbroadvoice-dev.install \
|
||||
debian/libbroadvoice-doc.install \
|
||||
debian/rules \
|
||||
debian/watch
|
||||
|
||||
if COND_DOC
|
||||
MAYBE_DOC=doc
|
||||
endif
|
||||
if COND_TESTS
|
||||
MAYBE_TESTS=tests
|
||||
endif
|
||||
SUBDIRS = src $(MAYBE_DOC) $(MAYBE_TESTS)
|
||||
|
||||
DIST_SUBDIRS = src doc tests test-data
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = broadvoice.pc
|
||||
|
||||
faq: faq.xml
|
||||
cd faq ; xsltproc ../wrapper.xsl ../faq.xml
|
||||
|
||||
rpm: rpm-build
|
||||
|
||||
rpm-build:
|
||||
$(MAKE) -$(MAKEFLAGS) bump.rpm.release
|
||||
$(MAKE) -$(MAKEFLAGS) dist
|
||||
rm -rf rpm/BUILD/*
|
||||
rm -f rpm/RPMS/*/*
|
||||
rm -f rpm/SOURCES/*
|
||||
rm -f rpm/SPECS/*
|
||||
rm -f rpm/SRPMS/*
|
||||
rpm -ta --sign @PACKAGE@-@VERSION@.tar.gz
|
||||
|
||||
bump.rpm.release: broadvoice.spec
|
||||
VERSION="x"; \
|
||||
test -f $(srcdir)/rpm.release && . $(srcdir)/rpm.release; \
|
||||
NEXT_RELEASE=0; \
|
||||
test "$$VERSION" = "@VERSION@" && NEXT_RELEASE="$$RELEASE"; \
|
||||
RELEASE=`expr $$NEXT_RELEASE + 1`; \
|
||||
echo "VERSION=@VERSION@" >$(srcdir)/rpm.release; \
|
||||
echo "RELEASE=$$RELEASE" >>$(srcdir)/rpm.release; \
|
||||
sed 's/^Release: .*/Release: '$$RELEASE'/' \
|
||||
<broadvoice.spec >broadvoice.spec.new; \
|
||||
mv broadvoice.spec.new broadvoice.spec
|
|
@ -1 +0,0 @@
|
|||
No news is good news!
|
|
@ -1,17 +0,0 @@
|
|||
broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
----------------------------------------------------------
|
||||
|
||||
The BroadVoice 16 speech codec is a 16kbps codec for narrowband (3.5kHz) speech.
|
||||
|
||||
The BroadVoice 32 speech codec is a 32kbps codec for wideband (7kHz) speech.
|
||||
|
||||
These codecs were developed by Broadcom, and are currently deployed in some popular
|
||||
VoIP phones. Broadcom have provided reference source code, under the LGPL 2.1
|
||||
licence. However, this code is not in a suitable form for easy integration with
|
||||
VoIP applications, and has a number of portability issues.
|
||||
|
||||
This library is based on the Broadcom reference code, but has been heavily modified
|
||||
so that it builds into a proper library, with a clean usable interface, on a
|
||||
range of platforms.
|
||||
|
||||
Steve Underwood <steveu@coppice.org>
|
|
@ -1,142 +0,0 @@
|
|||
#!/usr/bin/env sh
|
||||
#
|
||||
# broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
#
|
||||
# autogen script
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License version 2, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
UNAME=`uname`
|
||||
|
||||
if [ "x$UNAME" = "xFreeBSD" ]; then
|
||||
echo ""
|
||||
echo ""
|
||||
echo "******************************************"
|
||||
echo "*** NOTICE ***"
|
||||
echo "******************************************"
|
||||
echo " "
|
||||
echo "FreeBSD is buggy. Please use this "
|
||||
echo "workaround if you want to bootstrap "
|
||||
echo "on FreeBSD. "
|
||||
echo " "
|
||||
echo "cd /usr/local/share/aclocal19 "
|
||||
echo "ln -s ../aclocal/libtool15.m4 . "
|
||||
echo "ln -s ../aclocal/ltdl15.m4 . "
|
||||
echo " "
|
||||
echo "******************************************"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
debug ()
|
||||
{
|
||||
# Outputs debug statments if DEBUG var is set
|
||||
if [ ! -z "$DEBUG" ]; then
|
||||
echo "DEBUG: $1"
|
||||
fi
|
||||
}
|
||||
|
||||
version_compare()
|
||||
{
|
||||
# Checks a command is found and the version is high enough
|
||||
PROGRAM=$1
|
||||
MAJOR=$2
|
||||
MINOR=$3
|
||||
MICRO=$4
|
||||
test -z "$MAJOR" && MAJOR=0
|
||||
test -z "$MINOR" && MINOR=0
|
||||
test -z "$MICRO" && MICRO=0
|
||||
|
||||
debug "Checking $PROGRAM >= $MAJOR.$MINOR.$MICRO"
|
||||
|
||||
WHICH_PATH=`whereis which | cut -f2 -d' '`
|
||||
COMMAND=`$WHICH_PATH $PROGRAM`
|
||||
if [ -z $COMMAND ]; then
|
||||
echo "$PROGRAM-$MAJOR.$MINOR.$MICRO is required and was not found."
|
||||
return 1
|
||||
else
|
||||
debug "Found $COMMAND"
|
||||
fi
|
||||
|
||||
INS_VER=`$COMMAND --version | head -1 | sed 's/[^0-9]*//' | cut -d' ' -f1`
|
||||
INS_MAJOR=`echo $INS_VER | cut -d. -f1 | sed s/[a-zA-Z\-].*//g`
|
||||
INS_MINOR=`echo $INS_VER | cut -d. -f2 | sed s/[a-zA-Z\-].*//g`
|
||||
INS_MICRO=`echo $INS_VER | cut -d. -f3 | sed s/[a-zA-Z\-].*//g`
|
||||
test -z "$INS_MAJOR" && INS_MAJOR=0
|
||||
test -z "$INS_MINOR" && INS_MINOR=0
|
||||
test -z "$INS_MICRO" && INS_MICRO=0
|
||||
debug "Installed version: $INS_VER"
|
||||
|
||||
if [ "$INS_MAJOR" -gt "$MAJOR" ]; then
|
||||
debug "MAJOR: $INS_MAJOR > $MAJOR"
|
||||
return 0
|
||||
elif [ "$INS_MAJOR" -eq "$MAJOR" ]; then
|
||||
debug "MAJOR: $INS_MAJOR = $MAJOR"
|
||||
if [ "$INS_MINOR" -gt "$MINOR" ]; then
|
||||
debug "MINOR: $INS_MINOR > $MINOR"
|
||||
return 0
|
||||
elif [ "$INS_MINOR" -eq "$MINOR" ]; then
|
||||
if [ "$INS_MICRO" -ge "$MICRO" ]; then
|
||||
debug "MICRO: $INS_MICRO >= $MICRO"
|
||||
return 0
|
||||
else
|
||||
debug "MICRO: $INS_MICRO < $MICRO"
|
||||
fi
|
||||
else
|
||||
debug "MINOR: $INS_MINOR < $MINOR"
|
||||
fi
|
||||
else
|
||||
debug "MAJOR: $INS_MAJOR < $MAJOR"
|
||||
fi
|
||||
|
||||
echo "You have the wrong version of $PROGRAM. The minimum required version is $MAJOR.$MINOR.$MICRO"
|
||||
echo " and the version installed is $INS_MAJOR.$INS_MINOR.$INS_MICRO ($COMMAND)."
|
||||
return 1
|
||||
}
|
||||
|
||||
# Check for required version and die if unhappy
|
||||
|
||||
if [ "x$UNAME" = "xFreeBSD" ]; then
|
||||
version_compare libtoolize 1 5 16 || exit 1
|
||||
version_compare automake19 1 9 5 || exit 1
|
||||
version_compare autoconf259 2 59 || exit 1
|
||||
ACLOCAL=aclocal19
|
||||
AUTOHEADER=autoheader259
|
||||
AUTOMAKE=automake19
|
||||
AUTOCONF=autoconf259
|
||||
else
|
||||
version_compare libtoolize 1 5 16 || exit 1
|
||||
version_compare automake 1 9 5 || exit 1
|
||||
version_compare autoconf 2 59 || exit 1
|
||||
ACLOCAL=aclocal
|
||||
AUTOHEADER=autoheader
|
||||
AUTOMAKE=automake
|
||||
AUTOCONF=autoconf
|
||||
fi
|
||||
|
||||
libtoolize --copy --force --ltdl
|
||||
#NetBSD seems to need this file writable
|
||||
chmod u+w libltdl/configure
|
||||
|
||||
$ACLOCAL
|
||||
$AUTOHEADER --force
|
||||
$AUTOMAKE --copy --add-missing
|
||||
$AUTOCONF --force
|
||||
|
||||
#chmod ug+x debian/rules
|
||||
|
||||
if [ "x$UNAME" = "xNetBSD" ]; then
|
||||
echo ""
|
||||
echo "Please remember to run gmake instead of make on NetBSD"
|
||||
echo ""
|
||||
fi
|
|
@ -1,11 +0,0 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: spandsp
|
||||
Description: A library for the BroadVoice 16 and 32 speech codecs.
|
||||
Requires:
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -lbroadvoice -lm
|
||||
Cflags: -I${includedir}
|
|
@ -1,62 +0,0 @@
|
|||
Summary: broadvoice - a library for the BroadVoice 16 and 32 speech codecs
|
||||
Name: @PACKAGE@
|
||||
Version: @VERSION@
|
||||
Release: 1
|
||||
License: LGPL2.1
|
||||
Group: System Environment/Libraries
|
||||
URL: http://www.soft-switch.org/broadvoice
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-root
|
||||
Source: http://www.soft-switch.org/downloads/codecs/@PACKAGE@-@VERSION@.tar.gz
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
|
||||
BuildRequires: audiofile-devel
|
||||
BuildRequires: doxygen
|
||||
|
||||
%description
|
||||
broadvoice is a library for the BroadVoice 16 and 32 speech codecs.
|
||||
|
||||
%package devel
|
||||
Summary: BroadVoice development files
|
||||
Group: Development/Libraries
|
||||
Requires: libbroadvoice = %{version}
|
||||
PreReq: /sbin/install-info
|
||||
|
||||
%description devel
|
||||
libbroadvoice development files.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
%configure --enable-doc --disable-static --disable-rpath
|
||||
make
|
||||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
make install DESTDIR=%{buildroot}
|
||||
rm %{buildroot}%{_libdir}/libbroadvoice.la
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc ChangeLog AUTHORS COPYING NEWS README
|
||||
|
||||
%{_libdir}/libbroadvoice.so.*
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root,-)
|
||||
%doc doc/api
|
||||
%{_includedir}/broadvoice.h
|
||||
%{_includedir}/broadvoice
|
||||
%{_libdir}/libbroadvoice.so
|
||||
%{_libdir}/pkgconfig/broadvoice.pc
|
||||
|
||||
%post -p /sbin/ldconfig
|
||||
|
||||
%postun -p /sbin/ldconfig
|
||||
|
||||
%changelog
|
||||
* Sat Nov 15 2009 Steve Underwood <steveu@coppice.org> 0.0.1
|
||||
- First pass
|
|
@ -1,181 +0,0 @@
|
|||
# @synopsis AX_C99_FLEXIBLE_ARRAY
|
||||
#
|
||||
# Does the compiler support the 1999 ISO C Standard "struct hack".
|
||||
# @version 1.1 Mar 15 2004
|
||||
# @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this file for any
|
||||
# purpose is hereby granted without fee, provided that the above copyright
|
||||
# and this permission notice appear in all copies. No representations are
|
||||
# made about the suitability of this software for any purpose. It is
|
||||
# provided "as is" without express or implied warranty.
|
||||
|
||||
AC_DEFUN([AX_C99_FLEXIBLE_ARRAY],
|
||||
[AC_CACHE_CHECK(C99 struct flexible array support,
|
||||
ac_cv_c99_flexible_array,
|
||||
|
||||
# Initialize to unknown
|
||||
ac_cv_c99_flexible_array=no
|
||||
|
||||
AC_TRY_LINK([[
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct {
|
||||
int k;
|
||||
char buffer [] ;
|
||||
} MY_STRUCT ;
|
||||
]],
|
||||
[ MY_STRUCT *p = calloc (1, sizeof (MY_STRUCT) + 42); ],
|
||||
ac_cv_c99_flexible_array=yes,
|
||||
ac_cv_c99_flexible_array=no
|
||||
))]
|
||||
) # AX_C99_FLEXIBLE_ARRAY
|
||||
|
||||
# @synopsis AX_C99_FUNC_LRINT
|
||||
#
|
||||
# Check whether C99's lrint function is available.
|
||||
# @version 1.3 Feb 12 2002
|
||||
# @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this file for any
|
||||
# purpose is hereby granted without fee, provided that the above copyright
|
||||
# and this permission notice appear in all copies. No representations are
|
||||
# made about the suitability of this software for any purpose. It is
|
||||
# provided "as is" without express or implied warranty.
|
||||
#
|
||||
AC_DEFUN([AX_C99_FUNC_LRINT],
|
||||
[AC_CACHE_CHECK(for lrint,
|
||||
ac_cv_c99_lrint,
|
||||
[
|
||||
lrint_save_CFLAGS=$CFLAGS
|
||||
CFLAGS="-lm"
|
||||
AC_TRY_LINK([
|
||||
#define _ISOC9X_SOURCE 1
|
||||
#define _ISOC99_SOURCE 1
|
||||
#define __USE_ISOC99 1
|
||||
#define __USE_ISOC9X 1
|
||||
|
||||
#include <math.h>
|
||||
], if (!lrint(3.14159)) lrint(2.7183);, ac_cv_c99_lrint=yes, ac_cv_c99_lrint=no)
|
||||
|
||||
CFLAGS=$lrint_save_CFLAGS
|
||||
|
||||
])
|
||||
|
||||
if test "$ac_cv_c99_lrint" = yes; then
|
||||
AC_DEFINE(HAVE_LRINT, 1,
|
||||
[Define if you have C99's lrint function.])
|
||||
fi
|
||||
])# AX_C99_FUNC_LRINT
|
||||
|
||||
# @synopsis AX_C99_FUNC_LRINTF
|
||||
#
|
||||
# Check whether C99's lrintf function is available.
|
||||
# @version 1.3 Feb 12 2002
|
||||
# @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this file for any
|
||||
# purpose is hereby granted without fee, provided that the above copyright
|
||||
# and this permission notice appear in all copies. No representations are
|
||||
# made about the suitability of this software for any purpose. It is
|
||||
# provided "as is" without express or implied warranty.
|
||||
#
|
||||
AC_DEFUN([AX_C99_FUNC_LRINTF],
|
||||
[AC_CACHE_CHECK(for lrintf,
|
||||
ac_cv_c99_lrintf,
|
||||
[
|
||||
lrintf_save_CFLAGS=$CFLAGS
|
||||
CFLAGS="-lm"
|
||||
AC_TRY_LINK([
|
||||
#define _ISOC9X_SOURCE 1
|
||||
#define _ISOC99_SOURCE 1
|
||||
#define __USE_ISOC99 1
|
||||
#define __USE_ISOC9X 1
|
||||
|
||||
#include <math.h>
|
||||
], if (!lrintf(3.14159)) lrintf(2.7183);, ac_cv_c99_lrintf=yes, ac_cv_c99_lrintf=no)
|
||||
|
||||
CFLAGS=$lrintf_save_CFLAGS
|
||||
|
||||
])
|
||||
|
||||
if test "$ac_cv_c99_lrintf" = yes; then
|
||||
AC_DEFINE(HAVE_LRINTF, 1,
|
||||
[Define if you have C99's lrintf function.])
|
||||
fi
|
||||
])# AX_C99_FUNC_LRINTF
|
||||
|
||||
# @synopsis AX_C99_FUNC_LLRINT
|
||||
#
|
||||
# Check whether C99's llrint function is available.
|
||||
# @version 1.1 Sep 30 2002
|
||||
# @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this file for any
|
||||
# purpose is hereby granted without fee, provided that the above copyright
|
||||
# and this permission notice appear in all copies. No representations are
|
||||
# made about the suitability of this software for any purpose. It is
|
||||
# provided "as is" without express or implied warranty.
|
||||
#
|
||||
AC_DEFUN([AX_C99_FUNC_LLRINT],
|
||||
[AC_CACHE_CHECK(for llrint,
|
||||
ac_cv_c99_llrint,
|
||||
[
|
||||
llrint_save_CFLAGS=$CFLAGS
|
||||
CFLAGS="-lm"
|
||||
AC_TRY_LINK([
|
||||
#define ISOC9X_SOURCE 1
|
||||
#define _ISOC99_SOURCE 1
|
||||
#define __USE_ISOC99 1
|
||||
#define __USE_ISOC9X 1
|
||||
|
||||
#include <math.h>
|
||||
], long long int x ; x = llrint(3.14159) ;, ac_cv_c99_llrint=yes, ac_cv_c99_llrint=no)
|
||||
|
||||
CFLAGS=$llrint_save_CFLAGS
|
||||
|
||||
])
|
||||
|
||||
if test "$ac_cv_c99_llrint" = yes; then
|
||||
AC_DEFINE(HAVE_LLRINT, 1,
|
||||
[Define if you have C99's llrint function.])
|
||||
fi
|
||||
])# AX_C99_FUNC_LLRINT
|
||||
|
||||
|
||||
# @synopsis AX_C99_FUNC_LLRINTF
|
||||
#
|
||||
# Check whether C99's llrintf function is available.
|
||||
# @version 1.1 Sep 30 2002
|
||||
# @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this file for any
|
||||
# purpose is hereby granted without fee, provided that the above copyright
|
||||
# and this permission notice appear in all copies. No representations are
|
||||
# made about the suitability of this software for any purpose. It is
|
||||
# provided "as is" without express or implied warranty.
|
||||
#
|
||||
AC_DEFUN([AX_C99_FUNC_LLRINTF],
|
||||
[AC_CACHE_CHECK(for llrintf,
|
||||
ac_cv_c99_llrintf,
|
||||
[
|
||||
llrintf_save_CFLAGS=$CFLAGS
|
||||
CFLAGS="-lm"
|
||||
AC_TRY_LINK([
|
||||
#define _ISOC9X_SOURCE 1
|
||||
#define _ISOC99_SOURCE 1
|
||||
#define __USE_ISOC99 1
|
||||
#define __USE_ISOC9X 1
|
||||
|
||||
#include <math.h>
|
||||
], long long int x ; x = llrintf(3.14159) ;, ac_cv_c99_llrintf=yes, ac_cv_c99_llrintf=no)
|
||||
|
||||
CFLAGS=$llrintf_save_CFLAGS
|
||||
|
||||
])
|
||||
|
||||
if test "$ac_cv_c99_llrintf" = yes; then
|
||||
AC_DEFINE(HAVE_LLRINTF, 1,
|
||||
[Define if you have C99's llrintf function.])
|
||||
fi
|
||||
])# AX_C99_FUNC_LLRINTF
|
|
@ -1,61 +0,0 @@
|
|||
# @synopsis AX_CHECK_EXPORT_CAPABILITY
|
||||
#
|
||||
# Does the compiler support the exporting of library symbols?
|
||||
# @version 1.0 Jan 31 2009
|
||||
# @author Steve Underwood
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this file for any
|
||||
# purpose is hereby granted without fee, provided that the above copyright
|
||||
# and this permission notice appear in all copies. No representations are
|
||||
# made about the suitability of this software for any purpose. It is
|
||||
# provided "as is" without express or implied warranty.
|
||||
|
||||
AC_DEFUN([AX_CHECK_EXPORT_CAPABILITY],
|
||||
[AC_CACHE_CHECK([if $1 supports library symbol export],
|
||||
ac_cv_symbol_export_capability,
|
||||
|
||||
[# Initialize to unknown
|
||||
ac_cv_symbol_export_capability="no"
|
||||
|
||||
case "${ax_cv_c_compiler_vendor}" in
|
||||
gnu)
|
||||
save_CFLAGS="${CFLAGS}"
|
||||
CFLAGS="${CFLAGS} -fvisibility=hidden"
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[int foo __attribute__ ((visibility("default")));],
|
||||
[;]
|
||||
)],
|
||||
|
||||
[AC_MSG_RESULT([yes])
|
||||
COMP_VENDOR_CFLAGS="-fvisibility=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1 $COMP_VENDOR_CFLAGS"
|
||||
COMP_VENDOR_CXXFLAGS="-fvisibility=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1 $COMP_VENDOR_CXXFLAGS"
|
||||
ac_cv_symbol_export_capability="yes"],
|
||||
|
||||
[AC_MSG_RESULT([no])]
|
||||
)
|
||||
CFLAGS="${save_CFLAGS}"
|
||||
;;
|
||||
|
||||
sun)
|
||||
save_CFLAGS="${CFLAGS}"
|
||||
CFLAGS="${CFLAGS} -xldscope=hidden"
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[int foo __attribute__ ((visibility("default")));],
|
||||
[;]
|
||||
)],
|
||||
|
||||
[AC_MSG_RESULT([yes])
|
||||
COMP_VENDOR_CFLAGS="-xldscope=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1 $COMP_VENDOR_CFLAGS"
|
||||
COMP_VENDOR_CXXFLAGS="-xldscope=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1 $COMP_VENDOR_CXXFLAGS"
|
||||
ac_cv_symbol_export_capability="yes"],
|
||||
|
||||
[AC_MSG_RESULT([no])]
|
||||
)
|
||||
CFLAGS="${save_CFLAGS}"
|
||||
;;
|
||||
|
||||
esac])
|
||||
AS_IF([test AS_VAR_GET(ac_cv_symbol_export_capability) = yes], [$2], [$3])[]dnl
|
||||
]) # AX_CHECK_EXPORT_CAPABILITY
|
|
@ -1,27 +0,0 @@
|
|||
# AX_CHECK_REAL_FILE(FILE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
||||
# ------------------------------------------------------------------
|
||||
#
|
||||
# Check for the existence of FILE, and make sure it is a real file or
|
||||
# directory, and not a symbolic link.
|
||||
#
|
||||
AC_DEFUN([AX_CHECK_REAL_FILE],
|
||||
[AC_DIAGNOSE([cross],
|
||||
[cannot check for file existence when cross compiling])dnl
|
||||
AS_VAR_PUSHDEF([ac_RealFile], [ac_cv_real_file_$1])dnl
|
||||
AC_CACHE_CHECK([for $1], ac_RealFile,
|
||||
[test "$cross_compiling" = yes &&
|
||||
AC_MSG_ERROR([cannot check for file existence when cross compiling])
|
||||
if test -r "$1"
|
||||
then
|
||||
if test -h "$1"
|
||||
then
|
||||
AS_VAR_SET(ac_RealFile, no)
|
||||
else
|
||||
AS_VAR_SET(ac_RealFile, yes)
|
||||
fi
|
||||
else
|
||||
AS_VAR_SET(ac_RealFile, no)
|
||||
fi])
|
||||
AS_IF([test AS_VAR_GET(ac_RealFile) = yes], [$2], [$3])[]dnl
|
||||
AS_VAR_POPDEF([ac_RealFile])dnl
|
||||
])# AX_CHECK_REAL_FILE
|
|
@ -1,65 +0,0 @@
|
|||
# ===========================================================================
|
||||
# http://autoconf-archive.cryp.to/ax_compiler_vendor.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_COMPILER_VENDOR
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Determine the vendor of the C/C++ compiler, e.g., gnu, intel, ibm, sun,
|
||||
# hp, borland, comeau, dec, cray, kai, lcc, metrowerks, sgi, microsoft,
|
||||
# watcom, etc. The vendor is returned in the cache variable
|
||||
# $ax_cv_c_compiler_vendor for C and $ax_cv_cxx_compiler_vendor for C++.
|
||||
#
|
||||
# LAST MODIFICATION
|
||||
#
|
||||
# 2008-04-12
|
||||
#
|
||||
# COPYLEFT
|
||||
#
|
||||
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
|
||||
# Copyright (c) 2008 Matteo Frigo
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation, either version 3 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Macro Archive. When you make and
|
||||
# distribute a modified version of the Autoconf Macro, you may extend this
|
||||
# special exception to the GPL to apply to your modified version as well.
|
||||
|
||||
AC_DEFUN([AX_COMPILER_VENDOR],
|
||||
[
|
||||
AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,
|
||||
[ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=unknown
|
||||
# note: don't check for gcc first since some other compilers define __GNUC__
|
||||
for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ pathscale:__PATHCC__,__PATHSCALE__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do
|
||||
vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || defined(/g'`")"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[
|
||||
#if !($vencpp)
|
||||
thisisanerror;
|
||||
#endif
|
||||
])], [ax_cv_]_AC_LANG_ABBREV[_compiler_vendor=`echo $ventest | cut -d: -f1`; break])
|
||||
done
|
||||
])
|
||||
])
|
|
@ -1,35 +0,0 @@
|
|||
# AX_FIXED_POINT_MACHINE(MACHINE, [ACTION-IF-FIXED-POINT], [ACTION-IF-NOT-FIXED-POINT])
|
||||
# -------------------------------------------------------------------------------------
|
||||
#
|
||||
# Check if a specified machine type is a fixed point only machine. That is, if it lacks
|
||||
# fast floating point support.
|
||||
#
|
||||
# This is a simple lookup amongst machines known to the current autotools. So far we deal
|
||||
# with the embedded ARM, Blackfin, MIPS, TI DSP and XScale processors as things which lack
|
||||
# fast hardware floating point.
|
||||
#
|
||||
# Other candidates would be the small embedded Power PCs.
|
||||
#
|
||||
AC_DEFUN([AX_FIXED_POINT_MACHINE],
|
||||
[AS_VAR_PUSHDEF([ac_FixedPoint], [ac_cv_fixed_point_machine_$1])dnl
|
||||
AC_CACHE_CHECK([if $1 is fixed point only], ac_FixedPoint,
|
||||
[case $1 in
|
||||
arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] \
|
||||
| bfin \
|
||||
| mips | mipsbe | mipseb | mipsel | mipsle \
|
||||
| tic54x | c54x* | tic55x | c55x* | tic6x | c6x* \
|
||||
| xscale | xscalee[bl] \
|
||||
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
||||
| bfin-* \
|
||||
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||
| xscale-* | xscalee[bl]-* )
|
||||
AS_VAR_SET(ac_FixedPoint, yes)
|
||||
;;
|
||||
*)
|
||||
AS_VAR_SET(ac_FixedPoint, no)
|
||||
;;
|
||||
esac])
|
||||
AS_IF([test AS_VAR_GET(ac_FixedPoint) = yes], [$2], [$3])[]dnl
|
||||
AS_VAR_POPDEF([ac_FixedPoint])dnl
|
||||
])# AX_FIXED_POINT_MACHINE
|
|
@ -1,33 +0,0 @@
|
|||
# AX_MISALIGNED_ACCESS_FAILS(MACHINE, [ACTION-IF-MISALIGNED-FAILS], [ACTION-IF-MISALIGNED-OK])
|
||||
# -------------------------------------------------------------------------------------
|
||||
#
|
||||
# Check if a specified machine type cannot handle misaligned data. That is, multi-byte data
|
||||
# types which are not properly aligned in memory fail. Many machines are happy to work with
|
||||
# misaligned data, but slowing down a bit. Other machines just won't tolerate such data.
|
||||
#
|
||||
# This is a simple lookup amongst machines known to the current autotools. So far we only deal
|
||||
# with the ARM and sparc.
|
||||
# A lookup is used, as many of the devices which cannot handled misaligned access are embedded
|
||||
# processors, for which the code normally be cross-compiled.
|
||||
#
|
||||
AC_DEFUN([AX_MISALIGNED_ACCESS_FAILS],
|
||||
[AS_VAR_PUSHDEF([ac_MisalignedAccessFails], [ac_cv_misaligned_access_fails_$1])dnl
|
||||
AC_CACHE_CHECK([if $1 fails on misaligned memory access], ac_MisalignedAccessFails,
|
||||
[case $1 in
|
||||
arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] \
|
||||
| bfin \
|
||||
| sparc \
|
||||
| xscale | xscalee[bl] \
|
||||
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
||||
| bfin-* \
|
||||
| sparc-* \
|
||||
| xscale-* | xscalee[bl]-* )
|
||||
AS_VAR_SET(ac_MisalignedAccessFails, yes)
|
||||
;;
|
||||
*)
|
||||
AS_VAR_SET(ac_MisalignedAccessFails, no)
|
||||
;;
|
||||
esac])
|
||||
AS_IF([test AS_VAR_GET(ac_MisalignedAccessFails) = yes], [$2], [$3])[]dnl
|
||||
AS_VAR_POPDEF([ac_MisalignedAccessFails])dnl
|
||||
])# MISALIGNED_ACCESS_FAILS
|
|
@ -1,388 +0,0 @@
|
|||
#
|
||||
# broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
#
|
||||
# configure.ac -- Process this file with autoconf to produce configure
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License version 2, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
# $Id: configure.ac,v 1.2 2009/11/21 17:19:22 steveu Exp $
|
||||
|
||||
# @start 1
|
||||
|
||||
AC_INIT([broadvoice],[0.1.0])
|
||||
|
||||
CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
|
||||
LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
|
||||
|
||||
m4_include(config/ax_compiler_vendor.m4)
|
||||
m4_include(config/ax_check_real_file.m4)
|
||||
m4_include(config/ax_fixed_point_machine.m4)
|
||||
m4_include(config/ax_misaligned_access_fails.m4)
|
||||
m4_include(config/ax_c99_features.m4)
|
||||
m4_include(config/ax_check_export_capability.m4)
|
||||
|
||||
BROADVOICE_MAJOR_VERSION=0
|
||||
BROADVOICE_MINOR_VERSION=0
|
||||
BROADVOICE_MICRO_VERSION=1
|
||||
|
||||
BROADVOICE_LT_CURRENT=0
|
||||
BROADVOICE_LT_REVISION=1
|
||||
BROADVOICE_LT_AGE=0
|
||||
|
||||
VERSION=$BROADVOICE_MAJOR_VERSION.$BROADVOICE_MINOR_VERSION.$BROADVOICE_MICRO_VERSION
|
||||
PACKAGE=broadvoice
|
||||
|
||||
AC_SUBST(BROADVOICE_LT_CURRENT)
|
||||
AC_SUBST(BROADVOICE_LT_REVISION)
|
||||
AC_SUBST(BROADVOICE_LT_AGE)
|
||||
|
||||
AC_CONFIG_SRCDIR([src/bitpack32.c])
|
||||
AC_CONFIG_AUX_DIR([config])
|
||||
AC_CONFIG_HEADERS([src/config.h:config-h.in])
|
||||
AM_INIT_AUTOMAKE
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
#AC_CANONICAL_BUILD
|
||||
AC_PROG_CC
|
||||
AC_PROG_CXX
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
AC_PROG_LIBTOOL
|
||||
AC_LANG([C])
|
||||
|
||||
AX_COMPILER_VENDOR
|
||||
|
||||
if test "${build}" != "${host}"
|
||||
then
|
||||
# If we are doing a Canadian Cross, in which the host and build systems
|
||||
# are not the same, we set reasonable default values for the tools.
|
||||
|
||||
CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
|
||||
CPPFLAGS_FOR_BUILD="\$(CPPFLAGS)"
|
||||
CC=${CC-${host_alias}-gcc}
|
||||
CFLAGS=${CFLAGS-"-g -O2"}
|
||||
CXX=${CXX-${host_alias}-c++}
|
||||
CXXFLAGS=${CXXFLAGS-"-g -O2"}
|
||||
else
|
||||
# Set reasonable default values for some tools even if not Canadian.
|
||||
# Of course, these are different reasonable default values, originally
|
||||
# specified directly in the Makefile.
|
||||
# We don't export, so that autoconf can do its job.
|
||||
# Note that all these settings are above the fragment inclusion point
|
||||
# in Makefile.in, so can still be overridden by fragments.
|
||||
# This is all going to change when we autoconfiscate...
|
||||
CC_FOR_BUILD="\$(CC)"
|
||||
CPPFLAGS_FOR_BUILD="\$(CPPFLAGS)"
|
||||
AC_PROG_CC
|
||||
|
||||
# We must set the default linker to the linker used by gcc for the correct
|
||||
# operation of libtool. If LD is not defined and we are using gcc, try to
|
||||
# set the LD default to the ld used by gcc.
|
||||
if test -z "$LD"
|
||||
then
|
||||
if test "$GCC" = yes
|
||||
then
|
||||
case $build in
|
||||
*-*-mingw*)
|
||||
gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;;
|
||||
*)
|
||||
gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;;
|
||||
esac
|
||||
case $gcc_prog_ld in
|
||||
# Accept absolute paths.
|
||||
[[\\/]* | [A-Za-z]:[\\/]*)]
|
||||
LD="$gcc_prog_ld" ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
CXX=${CXX-"c++"}
|
||||
CFLAGS=${CFLAGS-"-g -O2"}
|
||||
CXXFLAGS=${CXXFLAGS-"-g -O2"}
|
||||
fi
|
||||
|
||||
AC_DEFUN([REMOVE_FROM_VAR],[
|
||||
new_val=""
|
||||
removed=0
|
||||
for i in $$1; do
|
||||
if test "x$i" != "x$2"; then
|
||||
new_val="$new_val $i"
|
||||
else
|
||||
removed=1
|
||||
fi
|
||||
done
|
||||
if test $removed = "1"; then
|
||||
echo " removed \"$2\" from $1"
|
||||
$1=$new_val
|
||||
fi
|
||||
])
|
||||
|
||||
AC_C_CONST
|
||||
AC_C_INLINE
|
||||
AC_C_VOLATILE
|
||||
|
||||
AC_CHECK_TYPES(long long)
|
||||
AC_CHECK_TYPES(long double)
|
||||
|
||||
AC_TYPE_SIGNAL
|
||||
|
||||
AC_ARG_ENABLE(doc, [ --enable-doc Build the documentation])
|
||||
AC_ARG_ENABLE(tests, [ --enable-tests Build the test programs])
|
||||
AC_ARG_ENABLE(mmx, [ --enable-mmx Enable MMX support])
|
||||
AC_ARG_ENABLE(sse, [ --enable-sse Enable SSE support])
|
||||
AC_ARG_ENABLE(sse2, [ --enable-sse2 Enable SSE2 support])
|
||||
AC_ARG_ENABLE(sse3, [ --enable-sse3 Enable SSE3 support])
|
||||
AC_ARG_ENABLE(sse3, [ --enable-sse3 Enable SSE3 support])
|
||||
AC_ARG_ENABLE(sse4_1, [ --enable-sse4-1 Enable SSE4.1 support])
|
||||
AC_ARG_ENABLE(sse4_2, [ --enable-sse4-2 Enable SSE4.2 support])
|
||||
AC_ARG_ENABLE(sse4a, [ --enable-sse4a Enable SSE4A support])
|
||||
AC_ARG_ENABLE(sse5, [ --enable-sse5 Enable SSE5 support])
|
||||
AC_ARG_ENABLE(fixed_point, [ --enable-fixed-point Enable fixed point support])
|
||||
|
||||
AC_FUNC_ERROR_AT_LINE
|
||||
AC_FUNC_VPRINTF
|
||||
AC_FUNC_MALLOC
|
||||
AC_FUNC_MEMCMP
|
||||
AC_FUNC_REALLOC
|
||||
AC_FUNC_SELECT_ARGTYPES
|
||||
|
||||
AX_C99_FUNC_LRINT
|
||||
AX_C99_FUNC_LRINTF
|
||||
AX_C99_FUNC_LLRINT
|
||||
AX_C99_FUNC_LLRINTF
|
||||
|
||||
if test "x$ac_cv_c99_lrint" = "xno" ; then
|
||||
if test "x$ac_cv_c99_lrintf" = "xno" ; then
|
||||
AC_MSG_WARN([[*** Missing C99 standard functions lrint() and lrintf().]])
|
||||
AC_MSG_WARN([[*** This may cause benign compiler warnings on some systems (ie Solaris).]])
|
||||
fi
|
||||
fi
|
||||
|
||||
AX_C99_FLEXIBLE_ARRAY
|
||||
|
||||
AC_CHECK_FUNCS([memmove])
|
||||
AC_CHECK_FUNCS([memset])
|
||||
AC_CHECK_FUNCS([select])
|
||||
AC_CHECK_FUNCS([strcasecmp])
|
||||
AC_CHECK_FUNCS([strchr])
|
||||
AC_CHECK_FUNCS([strdup])
|
||||
AC_CHECK_FUNCS([strerror])
|
||||
AC_CHECK_FUNCS([strstr])
|
||||
AC_CHECK_FUNCS([strtol])
|
||||
AC_CHECK_FUNCS([gettimeofday])
|
||||
|
||||
AC_HEADER_STDC
|
||||
AC_HEADER_SYS_WAIT
|
||||
AC_HEADER_TIME
|
||||
|
||||
# Check for header files.
|
||||
AC_CHECK_HEADERS([socket.h])
|
||||
AC_CHECK_HEADERS([inttypes.h], [INSERT_INTTYPES_HEADER="#include <inttypes.h>"])
|
||||
AC_CHECK_HEADERS([stdint.h], [INSERT_STDINT_HEADER="#include <stdint.h>"])
|
||||
AC_CHECK_HEADERS([unistd.h])
|
||||
AC_CHECK_HEADERS([stdlib.h])
|
||||
AC_CHECK_HEADERS([string.h])
|
||||
AC_CHECK_HEADERS([strings.h])
|
||||
AC_CHECK_HEADERS([malloc.h])
|
||||
AC_CHECK_HEADERS([tgmath.h], [INSERT_TGMATH_HEADER="#include <tgmath.h>"])
|
||||
AC_CHECK_HEADERS([math.h], [INSERT_MATH_HEADER="#include <math.h>"])
|
||||
AC_CHECK_HEADERS([float.h])
|
||||
AC_CHECK_HEADERS([fcntl.h])
|
||||
AC_CHECK_HEADERS([sys/time.h])
|
||||
AC_CHECK_HEADERS([sys/select.h])
|
||||
AC_CHECK_HEADERS([sys/ioctl.h])
|
||||
AC_CHECK_HEADERS([sys/fcntl.h])
|
||||
AC_CHECK_HEADERS([sndfile.h])
|
||||
|
||||
AC_LANG([C])
|
||||
|
||||
if test "${build}" = "${host}"
|
||||
then
|
||||
case "${host}" in
|
||||
x86_64-*)
|
||||
AX_CHECK_REAL_FILE([${prefix}/lib64], libdir='$(exec_prefix)/lib64')
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Checks for libraries.
|
||||
AC_CHECK_LIB([m], [cos])
|
||||
# Some platforms still seem to lack the basic single precision trig and power related function.
|
||||
AC_SEARCH_LIBS([sinf], [m], AC_DEFINE([HAVE_SINF], [1], [Define to 1 if you have the sinf() function.]))
|
||||
AC_SEARCH_LIBS([cosf], [m], AC_DEFINE([HAVE_COSF], [1], [Define to 1 if you have the cosf() function.]))
|
||||
AC_SEARCH_LIBS([tanf], [m], AC_DEFINE([HAVE_TANF], [1], [Define to 1 if you have the tanf() function.]))
|
||||
AC_SEARCH_LIBS([asinf], [m], AC_DEFINE([HAVE_ASINF], [1], [Define to 1 if you have the asinf() function.]))
|
||||
AC_SEARCH_LIBS([acosf], [m], AC_DEFINE([HAVE_ACOSF], [1], [Define to 1 if you have the acosf() function.]))
|
||||
AC_SEARCH_LIBS([atanf], [m], AC_DEFINE([HAVE_ATANF], [1], [Define to 1 if you have the atanf() function.]))
|
||||
AC_SEARCH_LIBS([atan2f], [m], AC_DEFINE([HAVE_ATAN2F], [1], [Define to 1 if you have the atan2f() function.]))
|
||||
AC_SEARCH_LIBS([ceilf], [m], AC_DEFINE([HAVE_CEILF], [1], [Define to 1 if you have the ceilf() function.]))
|
||||
AC_SEARCH_LIBS([floorf], [m], AC_DEFINE([HAVE_FLOORF], [1], [Define to 1 if you have the floorf() function.]))
|
||||
AC_SEARCH_LIBS([powf], [m], AC_DEFINE([HAVE_POWF], [1], [Define to 1 if you have the powf() function.]))
|
||||
AC_SEARCH_LIBS([expf], [m], AC_DEFINE([HAVE_EXPF], [1], [Define to 1 if you have the expf() function.]))
|
||||
AC_SEARCH_LIBS([logf], [m], AC_DEFINE([HAVE_LOGF], [1], [Define to 1 if you have the logf() function.]))
|
||||
AC_SEARCH_LIBS([log10f], [m], AC_DEFINE([HAVE_LOG10F], [1], [Define to 1 if you have the log10f() function.]))
|
||||
if test -n "$enable_tests" ; then
|
||||
AC_CHECK_LIB([sndfile], [sf_open], TESTLIBS="$TESTLIBS -lsndfile", AC_MSG_ERROR("Can't make tests without libsndfile (does your system require a libsndfile-devel package?)"))
|
||||
fi
|
||||
|
||||
AX_CHECK_EXPORT_CAPABILITY([$host],
|
||||
[AC_DEFINE([BROADVOICE_USE_EXPORT_CAPABILITY], [1], [Use the library symbol export capability of the compiler])
|
||||
BROADVOICE_USE_EXPORT_CAPABILITY="#define BROADVOICE_USE_EXPORT_CAPABILITY 1"],
|
||||
[BROADVOICE_USE_EXPORT_CAPABILITY="#undef BROADVOICE_USE_EXPORT_CAPABILITY"])
|
||||
|
||||
case "${ax_cv_c_compiler_vendor}" in
|
||||
gnu)
|
||||
COMP_VENDOR_CFLAGS="-std=gnu99 -ffast-math -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes"
|
||||
if test "$enable_sse5" = "yes" ; then
|
||||
COMP_VENDOR_CFLAGS="-msse5 $COMP_VENDOR_CFLAGS"
|
||||
fi
|
||||
if test "$enable_sse4a" = "yes" ; then
|
||||
COMP_VENDOR_CFLAGS="-msse4a $COMP_VENDOR_CFLAGS"
|
||||
fi
|
||||
if test "$enable_sse4_2" = "yes" ; then
|
||||
COMP_VENDOR_CFLAGS="-msse42 $COMP_VENDOR_CFLAGS"
|
||||
fi
|
||||
if test "$enable_sse4_1" = "yes" ; then
|
||||
COMP_VENDOR_CFLAGS="-msse41 $COMP_VENDOR_CFLAGS"
|
||||
fi
|
||||
if test "$enable_sse3" = "yes" ; then
|
||||
COMP_VENDOR_CFLAGS="-msse3 $COMP_VENDOR_CFLAGS"
|
||||
fi
|
||||
if test "$enable_sse2" = "yes" ; then
|
||||
COMP_VENDOR_CFLAGS="-msse2 $COMP_VENDOR_CFLAGS"
|
||||
fi
|
||||
if test "$enable_sse" = "yes" ; then
|
||||
COMP_VENDOR_CFLAGS="-msse $COMP_VENDOR_CFLAGS"
|
||||
fi
|
||||
if test "$enable_mmx" = "yes" ; then
|
||||
COMP_VENDOR_CFLAGS="-mmmx $COMP_VENDOR_CFLAGS"
|
||||
fi
|
||||
case $host_os in
|
||||
mingw* | cygwin*)
|
||||
COMP_VENDOR_LDFLAGS="-no-undefined"
|
||||
;;
|
||||
*)
|
||||
COMP_VENDOR_LDFLAGS=
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
sun)
|
||||
COMP_VENDOR_CFLAGS="-xc99=all -mt -xCC -errwarn=%all -xvpara"
|
||||
if test "$enable_sse3" = "yes" ; then
|
||||
COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS"
|
||||
fi
|
||||
if test "$enable_sse2" = "yes" ; then
|
||||
COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS"
|
||||
fi
|
||||
if test "$enable_sse" = "yes" ; then
|
||||
COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS"
|
||||
fi
|
||||
if test "$enable_mmx" = "yes" ; then
|
||||
COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS"
|
||||
fi
|
||||
COMP_VENDOR_LDFLAGS=
|
||||
REMOVE_FROM_VAR(CFLAGS, -Xc)
|
||||
;;
|
||||
*)
|
||||
COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes"
|
||||
COMP_VENDOR_LDFLAGS=
|
||||
;;
|
||||
esac
|
||||
|
||||
COMP_VENDOR_CFLAGS="-DNDEBUG $COMP_VENDOR_CFLAGS"
|
||||
|
||||
AM_CONDITIONAL([COND_DOC], [test "$enable_doc" = yes])
|
||||
AM_CONDITIONAL([COND_TESTS], [test "$enable_tests" = yes])
|
||||
AM_CONDITIONAL([COND_TESTDATA], [test "$enable_test_data" = yes])
|
||||
AM_CONDITIONAL([COND_MMX], [test "$enable_mmx" = yes])
|
||||
AM_CONDITIONAL([COND_SSE], [test "$enable_sse" = yes])
|
||||
AM_CONDITIONAL([COND_SSE2], [test "$enable_sse2" = yes])
|
||||
AM_CONDITIONAL([COND_SSE3], [test "$enable_sse3" = yes])
|
||||
AM_CONDITIONAL([COND_SSE4_1], [test "$enable_sse4_1" = yes])
|
||||
AM_CONDITIONAL([COND_SSE4_2], [test "$enable_sse4_2" = yes])
|
||||
AM_CONDITIONAL([COND_SSE4A], [test "$enable_sse4a" = yes])
|
||||
AM_CONDITIONAL([COND_SSE5], [test "$enable_sse5" = yes])
|
||||
if test "$enable_fixed_point" = "yes" ; then
|
||||
AC_DEFINE([BROADVOICE_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point])
|
||||
BROADVOICE_USE_FIXED_POINT="#define BROADVOICE_USE_FIXED_POINT 1"
|
||||
BROADVOICE_VECTORS_FOR_TESTS="fixed"
|
||||
else
|
||||
AX_FIXED_POINT_MACHINE([$host],
|
||||
[AC_DEFINE([BROADVOICE_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point])
|
||||
BROADVOICE_USE_FIXED_POINT="#define BROADVOICE_USE_FIXED_POINT 1"],
|
||||
[BROADVOICE_USE_FIXED_POINT="#undef BROADVOICE_USE_FIXED_POINT"])
|
||||
BROADVOICE_VECTORS_FOR_TESTS="floating"
|
||||
fi
|
||||
AX_MISALIGNED_ACCESS_FAILS([$host],
|
||||
[AC_DEFINE([BROADVOICE_MISALIGNED_ACCESS_FAILS], [1], [Do not expect a misaligned memory access to work correctly])
|
||||
BROADVOICE_MISALIGNED_ACCESS_FAILS="#define BROADVOICE_MISALIGNED_ACCESS_FAILS 1"],
|
||||
[BROADVOICE_MISALIGNED_ACCESS_FAILS="#undef BROADVOICE_MISALIGNED_ACCESS_FAILS"])
|
||||
|
||||
if test "$enable_sse5" = "yes" ; then
|
||||
AC_DEFINE([BROADVOICE_USE_SSE5], [1], [Use the SSE5 instruction set (i386 and x86_64 only).])
|
||||
enable_sse4a="yes"
|
||||
fi
|
||||
if test "$enable_sse4a" = "yes" ; then
|
||||
AC_DEFINE([BROADVOICE_USE_SSE4A], [1], [Use the SSE4A instruction set (i386 and x86_64 only).])
|
||||
enable_sse4_2="yes"
|
||||
fi
|
||||
if test "$enable_sse4_2" = "yes" ; then
|
||||
AC_DEFINE([BROADVOICE_USE_SSE4_2], [1], [Use the SSE4.2 instruction set (i386 and x86_64 only).])
|
||||
enable_sse4_1="yes"
|
||||
fi
|
||||
if test "$enable_sse4_1" = "yes" ; then
|
||||
AC_DEFINE([BROADVOICE_USE_SSE4_1], [1], [Use the SSE4.1 instruction set (i386 and x86_64 only).])
|
||||
enable_sse3="yes"
|
||||
fi
|
||||
if test "$enable_sse3" = "yes" ; then
|
||||
AC_DEFINE([BROADVOICE_USE_SSE3], [1], [Use the SSE3 instruction set (i386 and x86_64 only).])
|
||||
enable_sse2="yes"
|
||||
fi
|
||||
if test "$enable_sse2" = "yes" ; then
|
||||
AC_DEFINE([BROADVOICE_USE_SSE2], [1], [Use the SSE2 instruction set (i386 and x86_64 only).])
|
||||
enable_sse="yes"
|
||||
fi
|
||||
if test "$enable_sse" = "yes" ; then
|
||||
AC_DEFINE([BROADVOICE_USE_SSE], [1], [Use the SSE instruction set (i386 and x86_64 only).])
|
||||
enable_mmx="yes"
|
||||
fi
|
||||
if test "$enable_mmx" = "yes" ; then
|
||||
AC_DEFINE([BROADVOICE_USE_MMX], [1], [Use the MMX instruction set (i386 and x86_64 only).])
|
||||
fi
|
||||
|
||||
AC_SUBST(CC_FOR_BUILD)
|
||||
AC_SUBST(COMP_VENDOR_CFLAGS)
|
||||
AC_SUBST(COMP_VENDOR_LDFLAGS)
|
||||
AC_SUBST(TESTLIBS)
|
||||
AC_SUBST(BROADVOICE_USE_FIXED_POINT)
|
||||
AC_SUBST(BROADVOICE_MISALIGNED_ACCESS_FAILS)
|
||||
AC_SUBST(BROADVOICE_USE_EXPORT_CAPABILITY)
|
||||
AC_SUBST(BROADVOICE_VECTORS_FOR_TESTS)
|
||||
AC_SUBST(INSERT_INTTYPES_HEADER)
|
||||
AC_SUBST(INSERT_STDINT_HEADER)
|
||||
AC_SUBST(INSERT_TGMATH_HEADER)
|
||||
AC_SUBST(INSERT_MATH_HEADER)
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
doc/Makefile
|
||||
src/Makefile
|
||||
src/broadvoice.h
|
||||
broadvoice.pc
|
||||
broadvoice.spec])
|
||||
|
||||
AC_CONFIG_FILES([tests/regression_tests.sh], [chmod +x tests/regression_tests.sh])
|
||||
|
||||
AC_OUTPUT
|
||||
|
||||
# @end 1
|
|
@ -1,4 +0,0 @@
|
|||
#! /bin/sh
|
||||
srcpath=$(dirname $0 2>/dev/null ) || srcpath="."
|
||||
$srcpath/configure "$@" --disable-shared --with-pic
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
broadvoice (0.0.1) unstable; urgency=low
|
||||
|
||||
[ Steve Underwood ]
|
||||
* Begun
|
||||
|
||||
-- Steve Underwood <steveu@coppice.org> Tue, 19 Feb 2008 09:53:06 +0300
|
|
@ -1 +0,0 @@
|
|||
4
|
|
@ -1,34 +0,0 @@
|
|||
Source: broadvoice
|
||||
Section: libs
|
||||
Priority: optional
|
||||
Maintainer: Debian VoIP Team <pkg-voip-maintainers@lists.alioth.debian.org>
|
||||
Uploaders: Jose Carlos Garcia Sogo <jsogo@debian.org>, Kilian Krause <kilian@debian.org>, Santiago Garcia Mantinan <manty@debian.org>, Mark Purcell <msp@debian.org>, Tzafrir Cohen <tzafrir.cohen@xorcom.com>, Santiago Ruano Rincón <santiago@debian.org>
|
||||
Build-Depends: debhelper (>= 4.0.0), dpatch, doxygen, autotools-dev
|
||||
Standards-Version: 3.7.2
|
||||
XS-Vcs-Svn: svn://svn.debian.org/pkg-voip/
|
||||
XS-Vcs-Browser: http://svn.debian.org/wsvn/pkg-voip/
|
||||
|
||||
Package: libgbroadvoice
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}
|
||||
Conflicts: libbroadvoice0, libbroadvoice1, libbroadvoice2
|
||||
Description: Telephony signal processing library
|
||||
This package contains the BroadVoice 16 and 32 low bit rate speech codecs.
|
||||
.
|
||||
This package contains the shared library.
|
||||
|
||||
Package: libbroadvoice-dev
|
||||
Section: libdevel
|
||||
Architecture: any
|
||||
Depends: libbroadvoice3 (= ${Source-Version})
|
||||
Description: Telephony signal processing library
|
||||
This package contains the BroadVoice 16 and 32 low bit rate speech codecs.
|
||||
.
|
||||
This package contains the static library and development headers.
|
||||
.
|
||||
Homepage: http://www.soft-switch.org/
|
||||
|
||||
Package: libbroadvoice-doc
|
||||
Section: doc
|
||||
Architecture: all
|
||||
Description: Documentation for the Broadvoice 16 and 32 low bit rate speech codecs.
|
|
@ -1,10 +0,0 @@
|
|||
This package was debianized by Steve Underwood <steveu@coppice.org> on
|
||||
Tue, 19 Feb 2008 15:22:58 +0100.
|
||||
|
||||
It was downloaded from http://soft-switch.org/downloads/codecs/
|
||||
|
||||
Copyright: Various
|
||||
|
||||
License:
|
||||
|
||||
LGPL 2.1
|
|
@ -1,4 +0,0 @@
|
|||
debian/tmp/usr/include
|
||||
debian/tmp/usr/lib/libbroadvoice.so
|
||||
debian/tmp/usr/lib/libbroadvoice.la
|
||||
debian/tmp/usr/lib/libbroadvoice.a
|
|
@ -1 +0,0 @@
|
|||
doc/api/html usr/share/doc/broadvoice-doc/api/
|
|
@ -1,2 +0,0 @@
|
|||
debian/tmp/usr/lib/libbroadvoice.so.0.*
|
||||
debian/tmp/usr/lib/libbroadvoice.so.0
|
|
@ -1,105 +0,0 @@
|
|||
#!/usr/bin/make -f
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
|
||||
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
|
||||
|
||||
DEBVERSION:=$(shell head -n 1 debian/changelog \
|
||||
| sed -e 's/^[^(]*(\([^)]*\)).*/\1/')
|
||||
ORIGTARVER:=$(shell echo $(DEBVERSION) | sed -e 's/^.*://' -e 's/-[0-9.]*$$//')# -e 's/.dfsg$$//' -e 's/~//')
|
||||
|
||||
UPVERSION:=$(shell echo $(ORIGTARVER) | tr -d '~')
|
||||
|
||||
FILENAME := broadvoice_$(ORIGTARVER).orig.tar.gz
|
||||
FULLNAME := broadvoice-$(UPVERSION)
|
||||
URL := http://soft-switch.org/downloads/codecs/broadvoice-$(UPVERSION).tgz
|
||||
|
||||
CFLAGS = -Wall -g
|
||||
|
||||
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
|
||||
CFLAGS += -O0
|
||||
else
|
||||
CFLAGS += -O2
|
||||
endif
|
||||
|
||||
include /usr/share/dpatch/dpatch.make
|
||||
|
||||
|
||||
autotools: patch-stamp
|
||||
ln -s /usr/share/misc/config.sub config.sub
|
||||
ln -s /usr/share/misc/config.guess config.guess
|
||||
touch autotools
|
||||
|
||||
config.status: autotools configure
|
||||
dh_testdir
|
||||
CFLAGS="$(CFLAGS)" ./configure \
|
||||
--host=$(DEB_HOST_GNU_TYPE) \
|
||||
--build=$(DEB_BUILD_GNU_TYPE) \
|
||||
--prefix=/usr \
|
||||
--mandir=\$${prefix}/share/man \
|
||||
--infodir=\$${prefix}/share/info \
|
||||
--enable-doc
|
||||
|
||||
build: build-stamp
|
||||
|
||||
build-stamp: config.status
|
||||
dh_testdir
|
||||
$(MAKE)
|
||||
touch build-stamp
|
||||
|
||||
clean: clean-patched unpatch
|
||||
clean-patched:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f build-stamp autotools
|
||||
-$(MAKE) distclean
|
||||
|
||||
-$(RM) -f config.sub
|
||||
-$(RM) -f config.guess
|
||||
|
||||
dh_clean
|
||||
|
||||
install: build-stamp
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
|
||||
|
||||
binary-indep: build-stamp install
|
||||
dh_testdir -i
|
||||
dh_testroot -i
|
||||
dh_installchangelogs -i ChangeLog
|
||||
dh_install -i
|
||||
dh_compress -i
|
||||
dh_fixperms -i
|
||||
dh_installdeb -i
|
||||
dh_gencontrol -i
|
||||
dh_md5sums -i
|
||||
dh_builddeb -i
|
||||
|
||||
binary-arch: build-stamp install
|
||||
dh_testdir -a
|
||||
dh_testroot -a
|
||||
dh_installchangelogs -a ChangeLog
|
||||
dh_installdocs -a DueDiligence
|
||||
dh_install -a
|
||||
dh_strip -a
|
||||
dh_compress -a
|
||||
dh_fixperms -a
|
||||
dh_makeshlibs -a
|
||||
dh_installdeb -a
|
||||
dh_shlibdeps -a
|
||||
dh_gencontrol -a
|
||||
dh_md5sums -a
|
||||
dh_builddeb -a
|
||||
|
||||
get-orig-source:
|
||||
-@@dh_testdir
|
||||
@@[ -d ../tarballs/. ]||mkdir -p ../tarballs
|
||||
@@echo Downloading $(FILENAME) from $(URL) ...
|
||||
@@wget -N -nv -T10 -t3 -O ../tarballs/$(FILENAME) $(URL)
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary install patch unpatch
|
|
@ -1,7 +0,0 @@
|
|||
# See uscan(1) for format
|
||||
|
||||
# Compulsory line, this is a version 1 file
|
||||
version=1
|
||||
|
||||
# <Webpage URL> <string match>
|
||||
http://soft-switch.org/downloads/voipcodecs/ broadvoice-(.*)\.tgz debian svn-upgrade
|
|
@ -1,29 +0,0 @@
|
|||
##
|
||||
## broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
##
|
||||
## Makefile.am -- Process this file with automake to produce Makefile.in
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License version 2, as
|
||||
## published by the Free Software Foundation.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
##
|
||||
## $Id: Makefile.am,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
EXTRA_DIST = css.css \
|
||||
wrapper.xsl
|
||||
|
||||
all: doxydocs
|
||||
|
||||
doxydocs:
|
||||
doxygen broadvoice-doxygen
|
File diff suppressed because it is too large
Load Diff
|
@ -1,564 +0,0 @@
|
|||
body {
|
||||
background-image: url("../images/weave.jpg");
|
||||
font-family: Verdana, Arial, Helvetica, Sans-serif;
|
||||
color: black;
|
||||
margin-right: 20px;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-family: Verdana, Arial, Helvetica, Sans-serif;
|
||||
border-color: #c00000;
|
||||
color : black;
|
||||
margin-top: 0.8em;
|
||||
border-style: solid;
|
||||
border-width: 0px 0px 3px 0.5em;
|
||||
line-height : 130%;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-family: Verdana, Arial, Helvetica, Sans-serif;
|
||||
border-color: #f02020;
|
||||
color : black;
|
||||
border-width: 0px 0px 2px 0.5em;
|
||||
border-style: solid;
|
||||
margin-right: 20%;
|
||||
line-height : 130%;
|
||||
}
|
||||
caption {
|
||||
font-weight: bold
|
||||
}
|
||||
a.qindex {}
|
||||
a.qindexRef {}
|
||||
a.el {
|
||||
text-decoration: none;
|
||||
font-weight: bold
|
||||
}
|
||||
a.elRef {
|
||||
font-weight: bold
|
||||
}
|
||||
a.code {
|
||||
text-decoration: none;
|
||||
font-weight: normal;
|
||||
color: #4444ee
|
||||
}
|
||||
a.codeRef {
|
||||
font-weight: normal;
|
||||
color: #4444ee
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: none;
|
||||
background-color: #f2f2ff
|
||||
}
|
||||
dl.el {
|
||||
margin-left: -1cm
|
||||
}
|
||||
div.fragment {
|
||||
width: 100%;
|
||||
border: none;
|
||||
background-color: #eeeeee
|
||||
}
|
||||
div.ah {
|
||||
background-color: black;
|
||||
font-weight: bold;
|
||||
color: #ffffff;
|
||||
margin-bottom: 3px;
|
||||
margin-top: 3px
|
||||
}
|
||||
|
||||
td {
|
||||
font-family: Verdana, Arial, Helvetica, Sans-serif;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.navheader {
|
||||
font-family: Verdana, Arial, Helvetica, Sans-serif;
|
||||
background-color: #B2B2ff;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.navfooter {
|
||||
font-family: Verdana, Arial, Helvetica, Sans-serif;
|
||||
background-color: #B2B2ff;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.menu {
|
||||
background-color: #000066;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
tr.menu {
|
||||
background-color: #ccffff;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
}
|
||||
td.menu {
|
||||
background-color: #f2e0d0;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
td.md {
|
||||
background-color: #f2f2ff;
|
||||
font-weight: bold;
|
||||
}
|
||||
td.mdname1 {
|
||||
background-color: #f2f2ff;
|
||||
font-weight: bold;
|
||||
color: #602020;
|
||||
}
|
||||
td.mdname {
|
||||
background-color: #f2f2ff;
|
||||
font-weight: bold;
|
||||
color: #602020;
|
||||
width: 600px;
|
||||
}
|
||||
div.groupHeader {
|
||||
margin-left: 16px;
|
||||
margin-top: 12px;
|
||||
margin-bottom: 6px;
|
||||
font-weight: bold
|
||||
}
|
||||
div.groupText {
|
||||
margin-left: 16px;
|
||||
font-style: italic;
|
||||
font-size: smaller
|
||||
}
|
||||
td.indexkey {
|
||||
font-family: Verdana, Arial, Helvetica, Sans-serif;
|
||||
background-color: #eeeeff;
|
||||
font-weight: bold;
|
||||
padding-right : 10px;
|
||||
padding-top : 2px;
|
||||
padding-left : 10px;
|
||||
padding-bottom : 2px;
|
||||
margin-left : 0px;
|
||||
margin-right : 0px;
|
||||
margin-top : 2px;
|
||||
margin-bottom : 2px
|
||||
}
|
||||
td.indexvalue {
|
||||
font-family: Verdana, Arial, Helvetica, Sans-serif;
|
||||
background-color: #eeeeff;
|
||||
font-style: italic;
|
||||
padding-right : 10px;
|
||||
padding-top : 2px;
|
||||
padding-left : 10px;
|
||||
padding-bottom : 2px;
|
||||
margin-left : 0px;
|
||||
margin-right : 0px;
|
||||
margin-top : 2px;
|
||||
margin-bottom : 2px
|
||||
}
|
||||
span.keyword {
|
||||
color: #008000
|
||||
}
|
||||
span.keywordtype {
|
||||
color: #604020
|
||||
}
|
||||
span.keywordflow {
|
||||
color: #e08000
|
||||
}
|
||||
span.comment {
|
||||
color: #800000
|
||||
}
|
||||
span.preprocessor {
|
||||
color: #806020
|
||||
}
|
||||
span.stringliteral {
|
||||
color: #002080
|
||||
}
|
||||
span.charliteral {
|
||||
color: #008080
|
||||
}
|
||||
em {
|
||||
color: #990000;
|
||||
background-color: transparent;
|
||||
}
|
||||
h1,h2,h3,h4,h5,h6,p,center,td,th,ul,dl,div {
|
||||
font-family: Geneva, Arial, Helvetica, sans-serif;
|
||||
}
|
||||
body,td {
|
||||
font-size: 90%;
|
||||
}
|
||||
h1 {
|
||||
text-align: center;
|
||||
font-size: 160%;
|
||||
}
|
||||
h2 {
|
||||
font-size: 120%;
|
||||
}
|
||||
h3 {
|
||||
font-size: 100%;
|
||||
}
|
||||
caption {
|
||||
font-weight: bold
|
||||
}
|
||||
div.qindex {
|
||||
width: 100%;
|
||||
background-color: #eeeeff;
|
||||
border: 1px solid #b0b0b0;
|
||||
text-align: center;
|
||||
margin: 2px;
|
||||
padding: 2px;
|
||||
line-height: 140%;
|
||||
}
|
||||
div.nav {
|
||||
width: 100%;
|
||||
background-color: #eeeeff;
|
||||
border: 1px solid #b0b0b0;
|
||||
text-align: center;
|
||||
margin: 2px;
|
||||
padding: 2px;
|
||||
line-height: 140%;
|
||||
}
|
||||
div.navtab {
|
||||
background-color: #eeeeff;
|
||||
border: 1px solid #b0b0b0;
|
||||
text-align: center;
|
||||
margin: 2px;
|
||||
margin-right: 15px;
|
||||
padding: 2px;
|
||||
}
|
||||
td.navtab {
|
||||
font-size: 70%;
|
||||
}
|
||||
a.qindex {
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
color: #1a419d;
|
||||
}
|
||||
a.qindex:visited {
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
color: #1a419d
|
||||
}
|
||||
a.qindex:hover {
|
||||
text-decoration: none;
|
||||
background-color: #ddddff;
|
||||
}
|
||||
a.qindexHL {
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
background-color: #6666cc;
|
||||
color: #ffffff;
|
||||
border: 1px double #9295C2;
|
||||
}
|
||||
a.qindexHL:hover {
|
||||
text-decoration: none;
|
||||
background-color: #6666cc;
|
||||
color: #ffffff;
|
||||
}
|
||||
a.qindexHL:visited {
|
||||
text-decoration: none;
|
||||
background-color: #6666cc;
|
||||
color: #ffffff
|
||||
}
|
||||
a.el {
|
||||
text-decoration: none;
|
||||
font-weight: bold
|
||||
}
|
||||
a.elRef {
|
||||
font-weight: bold
|
||||
}
|
||||
a.code:link {
|
||||
text-decoration: none;
|
||||
font-weight: normal;
|
||||
color: #0000FF
|
||||
}
|
||||
a.code:visited {
|
||||
text-decoration: none;
|
||||
font-weight: normal;
|
||||
color: #0000FF
|
||||
}
|
||||
a.codeRef:link {
|
||||
font-weight: normal;
|
||||
color: #0000FF
|
||||
}
|
||||
a.codeRef:visited {
|
||||
font-weight: normal;
|
||||
color: #0000FF
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: none;
|
||||
background-color: #f2f2ff
|
||||
}
|
||||
dl.el {
|
||||
margin-left: -1cm
|
||||
}
|
||||
.fragment {
|
||||
font-family: Fixed, monospace;
|
||||
font-size: 95%;
|
||||
}
|
||||
pre.fragment {
|
||||
border: 1px solid #CCCCCC;
|
||||
background-color: #f5f5f5;
|
||||
margin-top: 4px;
|
||||
margin-bottom: 4px;
|
||||
margin-left: 2px;
|
||||
margin-right: 8px;
|
||||
padding-left: 6px;
|
||||
padding-right: 6px;
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
div.ah {
|
||||
background-color: black;
|
||||
font-weight: bold;
|
||||
color: #ffffff;
|
||||
margin-bottom: 3px;
|
||||
margin-top: 3px
|
||||
}
|
||||
td.md {
|
||||
background-color: #F4F4FB;
|
||||
font-weight: bold;
|
||||
}
|
||||
td.mdPrefix {
|
||||
background-color: #F4F4FB;
|
||||
color: #606060;
|
||||
font-size: 80%;
|
||||
}
|
||||
td.mdname1 {
|
||||
background-color: #F4F4FB;
|
||||
font-weight: bold;
|
||||
color: #602020;
|
||||
}
|
||||
td.mdname {
|
||||
background-color: #F4F4FB;
|
||||
font-weight: bold;
|
||||
color: #602020;
|
||||
width: 600px;
|
||||
}
|
||||
div.groupHeader {
|
||||
margin-left: 16px;
|
||||
margin-top: 12px;
|
||||
margin-bottom: 6px;
|
||||
font-weight: bold;
|
||||
}
|
||||
div.groupText {
|
||||
margin-left: 16px;
|
||||
font-style: italic;
|
||||
font-size: 90%
|
||||
}
|
||||
td.indexkey {
|
||||
background-color: #eeeeff;
|
||||
font-weight: bold;
|
||||
padding-right : 10px;
|
||||
padding-top : 2px;
|
||||
padding-left : 10px;
|
||||
padding-bottom : 2px;
|
||||
margin-left : 0px;
|
||||
margin-right : 0px;
|
||||
margin-top : 2px;
|
||||
margin-bottom : 2px;
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
td.indexvalue {
|
||||
background-color: #eeeeff;
|
||||
font-style: italic;
|
||||
padding-right : 10px;
|
||||
padding-top : 2px;
|
||||
padding-left : 10px;
|
||||
padding-bottom : 2px;
|
||||
margin-left : 0px;
|
||||
margin-right : 0px;
|
||||
margin-top : 2px;
|
||||
margin-bottom : 2px;
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
tr.memlist {
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
p.formulaDsp {
|
||||
text-align: center;
|
||||
}
|
||||
img.formulaDsp {
|
||||
}
|
||||
img.formulaInl {
|
||||
vertical-align: middle;
|
||||
}
|
||||
span.keyword {
|
||||
color: #008000
|
||||
}
|
||||
span.keywordtype {
|
||||
color: #604020
|
||||
}
|
||||
span.keywordflow {
|
||||
color: #e08000
|
||||
}
|
||||
span.comment {
|
||||
color: #800000
|
||||
}
|
||||
span.preprocessor {
|
||||
color: #806020
|
||||
}
|
||||
span.stringliteral {
|
||||
color: #002080
|
||||
}
|
||||
span.charliteral {
|
||||
color: #008080
|
||||
}
|
||||
.mdTable {
|
||||
border: 1px solid #868686;
|
||||
background-color: #F4F4FB;
|
||||
}
|
||||
.mdRow {
|
||||
padding: 8px 10px;
|
||||
}
|
||||
.mdescLeft {
|
||||
padding: 0px 8px 4px 8px;
|
||||
font-size: 80%;
|
||||
font-style: italic;
|
||||
background-color: #FAFAFA;
|
||||
border-top: 1px none #E0E0E0;
|
||||
border-right: 1px none #E0E0E0;
|
||||
border-bottom: 1px none #E0E0E0;
|
||||
border-left: 1px none #E0E0E0;
|
||||
margin: 0px;
|
||||
}
|
||||
.mdescRight {
|
||||
padding: 0px 8px 4px 8px;
|
||||
font-size: 80%;
|
||||
font-style: italic;
|
||||
background-color: #FAFAFA;
|
||||
border-top: 1px none #E0E0E0;
|
||||
border-right: 1px none #E0E0E0;
|
||||
border-bottom: 1px none #E0E0E0;
|
||||
border-left: 1px none #E0E0E0;
|
||||
margin: 0px;
|
||||
}
|
||||
.memItemLeft {
|
||||
padding: 1px 0px 0px 8px;
|
||||
margin: 4px;
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
border-top-color: #E0E0E0;
|
||||
border-right-color: #E0E0E0;
|
||||
border-bottom-color: #E0E0E0;
|
||||
border-left-color: #E0E0E0;
|
||||
border-top-style: solid;
|
||||
border-right-style: none;
|
||||
border-bottom-style: none;
|
||||
border-left-style: none;
|
||||
background-color: #FAFAFA;
|
||||
font-size: 80%;
|
||||
}
|
||||
.memItemRight {
|
||||
padding: 1px 8px 0px 8px;
|
||||
margin: 4px;
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
border-top-color: #E0E0E0;
|
||||
border-right-color: #E0E0E0;
|
||||
border-bottom-color: #E0E0E0;
|
||||
border-left-color: #E0E0E0;
|
||||
border-top-style: solid;
|
||||
border-right-style: none;
|
||||
border-bottom-style: none;
|
||||
border-left-style: none;
|
||||
background-color: #FAFAFA;
|
||||
font-size: 80%;
|
||||
}
|
||||
.memTemplItemLeft {
|
||||
padding: 1px 0px 0px 8px;
|
||||
margin: 4px;
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
border-top-color: #E0E0E0;
|
||||
border-right-color: #E0E0E0;
|
||||
border-bottom-color: #E0E0E0;
|
||||
border-left-color: #E0E0E0;
|
||||
border-top-style: none;
|
||||
border-right-style: none;
|
||||
border-bottom-style: none;
|
||||
border-left-style: none;
|
||||
background-color: #FAFAFA;
|
||||
font-size: 80%;
|
||||
}
|
||||
.memTemplItemRight {
|
||||
padding: 1px 8px 0px 8px;
|
||||
margin: 4px;
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
border-top-color: #E0E0E0;
|
||||
border-right-color: #E0E0E0;
|
||||
border-bottom-color: #E0E0E0;
|
||||
border-left-color: #E0E0E0;
|
||||
border-top-style: none;
|
||||
border-right-style: none;
|
||||
border-bottom-style: none;
|
||||
border-left-style: none;
|
||||
background-color: #FAFAFA;
|
||||
font-size: 80%;
|
||||
}
|
||||
.memTemplParams {
|
||||
padding: 1px 0px 0px 8px;
|
||||
margin: 4px;
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
border-top-color: #E0E0E0;
|
||||
border-right-color: #E0E0E0;
|
||||
border-bottom-color: #E0E0E0;
|
||||
border-left-color: #E0E0E0;
|
||||
border-top-style: solid;
|
||||
border-right-style: none;
|
||||
border-bottom-style: none;
|
||||
border-left-style: none;
|
||||
color: #606060;
|
||||
background-color: #FAFAFA;
|
||||
font-size: 80%;
|
||||
}
|
||||
.search {
|
||||
color: #003399;
|
||||
font-weight: bold;
|
||||
}
|
||||
form.search {
|
||||
margin-bottom: 0px;
|
||||
margin-top: 0px;
|
||||
}
|
||||
input.search {
|
||||
font-size: 75%;
|
||||
color: #000080;
|
||||
font-weight: normal;
|
||||
background-color: #eeeeff;
|
||||
}
|
||||
td.tiny {
|
||||
font-size: 75%;
|
||||
}
|
||||
a {
|
||||
color: #252e78;
|
||||
}
|
||||
a:visited {
|
||||
color: #3d2185;
|
||||
}
|
||||
.dirtab {
|
||||
padding: 4px;
|
||||
border-collapse: collapse;
|
||||
border: 1px solid #b0b0b0;
|
||||
}
|
||||
th.dirtab {
|
||||
background: #eeeeff;
|
||||
font-weight: bold;
|
||||
}
|
||||
hr {
|
||||
height: 1px;
|
||||
border: none;
|
||||
border-top: 1px solid black;
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
version='1.0'>
|
||||
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/chunk.xsl"/>
|
||||
<xsl:param name="html.stylesheet">css.css</xsl:param>
|
||||
</xsl:stylesheet>
|
|
@ -1,194 +0,0 @@
|
|||
##
|
||||
## broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
##
|
||||
## Makefile.am -- Process this file with automake to produce Makefile.in
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the Lesser GNU General Public License version 2.1, as
|
||||
## published by the Free Software Foundation.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
##
|
||||
## $Id: Makefile.am,v 1.4 2009/11/21 17:19:22 steveu Exp $
|
||||
|
||||
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
|
||||
AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
EXTRA_DIST = libbroadvoice.dsp \
|
||||
libbroadvoice.2005.sln \
|
||||
libbroadvoice.2008.sln \
|
||||
libbroadvoice.2005.vcproj \
|
||||
libbroadvoice.2008.vcproj \
|
||||
msvc/gettimeofday.c \
|
||||
msvc/inttypes.h \
|
||||
msvc/tgmath.h \
|
||||
msvc/unistd.h \
|
||||
msvc/sys/time.h \
|
||||
msvc/broadvoice.def \
|
||||
msvc/msvcproj.head \
|
||||
msvc/msvcproj.foot \
|
||||
msvc/vc8proj.foot \
|
||||
msvc/vc8proj.head \
|
||||
msvc/vc9proj.foot \
|
||||
msvc/vc9proj.head \
|
||||
broadvoice/version.h.in
|
||||
|
||||
AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/floating/common -I$(srcdir)/floating/bv16 -I$(srcdir)/floating/bv32
|
||||
|
||||
lib_LTLIBRARIES = libbroadvoice.la
|
||||
|
||||
libbroadvoice_la_SOURCES = bitstream.c \
|
||||
floating/common/a2lsp.c \
|
||||
floating/common/allpole.c \
|
||||
floating/common/allzero.c \
|
||||
floating/common/autocor.c \
|
||||
floating/common/cmtables.c \
|
||||
floating/common/levdur.c \
|
||||
floating/common/lsp2a.c \
|
||||
floating/common/stblchck.c \
|
||||
floating/common/stblzlsp.c \
|
||||
floating/common/utility.c \
|
||||
bitpack16.c \
|
||||
floating/bv16/bv16decoder.c \
|
||||
floating/bv16/bv16encoder.c \
|
||||
floating/bv16/bv16coarse_pitch.c \
|
||||
floating/bv16/bv16excdec.c \
|
||||
floating/bv16/bv16excquan.c \
|
||||
floating/bv16/bv16fine_pitch.c \
|
||||
floating/bv16/bv16gaindec.c \
|
||||
floating/bv16/bv16gainquan.c \
|
||||
floating/bv16/bv16levelest.c \
|
||||
floating/bv16/bv16lspdec.c \
|
||||
floating/bv16/bv16lspquan.c \
|
||||
floating/bv16/bv16plc.c \
|
||||
floating/bv16/bv16ptdec.c \
|
||||
floating/bv16/bv16postfilter.c \
|
||||
floating/bv16/bv16ptquan.c \
|
||||
floating/bv16/bv16tables.c \
|
||||
bitpack32.c \
|
||||
floating/bv32/bv32decoder.c \
|
||||
floating/bv32/bv32encoder.c \
|
||||
floating/bv32/bv32coarse_pitch.c \
|
||||
floating/bv32/bv32excdec.c \
|
||||
floating/bv32/bv32excquan.c \
|
||||
floating/bv32/bv32fine_pitch.c \
|
||||
floating/bv32/bv32gaindec.c \
|
||||
floating/bv32/bv32gainquan.c \
|
||||
floating/bv32/bv32levelest.c \
|
||||
floating/bv32/bv32lspdec.c \
|
||||
floating/bv32/bv32lspquan.c \
|
||||
floating/bv32/bv32plc.c \
|
||||
floating/bv32/bv32ptdec.c \
|
||||
floating/bv32/bv32ptquan.c \
|
||||
floating/bv32/bv32tables.c
|
||||
|
||||
libbroadvoice_la_LDFLAGS = -version-info @BROADVOICE_LT_CURRENT@:@BROADVOICE_LT_REVISION@:@BROADVOICE_LT_AGE@ $(COMP_VENDOR_LDFLAGS)
|
||||
|
||||
nobase_include_HEADERS = broadvoice/broadvoice.h \
|
||||
broadvoice/version.h \
|
||||
broadvoice/private/broadvoice.h
|
||||
|
||||
nodist_include_HEADERS = broadvoice.h
|
||||
|
||||
noinst_HEADERS = bitpack16.h \
|
||||
bitpack32.h \
|
||||
bitstream.h \
|
||||
floating/bv16/bv16cnst.h \
|
||||
floating/bv16/bv16externs.h \
|
||||
floating/bv16/bv16postfilter.h \
|
||||
floating/bv16/bv16strct.h \
|
||||
floating/bv32/bv32cnst.h \
|
||||
floating/bv32/bv32externs.h \
|
||||
floating/bv32/bv32strct.h \
|
||||
floating/common/bvcommon.h \
|
||||
floating/common/typedef.h \
|
||||
floating/common/utility.h
|
||||
|
||||
noinst_PROGRAMS =
|
||||
|
||||
DSP = libbroadvoice.dsp
|
||||
VCPROJ8 = libbroadvoice.2005.vcproj
|
||||
VCPROJ9 = libbroadvoice.2008.vcproj
|
||||
|
||||
WIN32SOURCES = $(libbroadvoice_la_SOURCES) .\\msvc\\gettimeofday.c
|
||||
WIN32HEADERS = $(nobase_include_HEADERS) broadvoice.h
|
||||
|
||||
DSPOUT = | awk '{printf("%s\r\n", $$0)}' >> $(DSP)
|
||||
VCPROJOUT8 = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ8)
|
||||
VCPROJOUT9 = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ9)
|
||||
|
||||
$(DSP): msvc/msvcproj.head msvc/msvcproj.foot Makefile.am
|
||||
echo "creating $(DSP)"
|
||||
@(cp $(srcdir)/msvc/msvcproj.head $(DSP); \
|
||||
echo "# Begin Group \"Source Files\"" $(DSPOUT); \
|
||||
for file in $(WIN32SOURCES); do \
|
||||
echo "# Begin Source File" $(DSPOUT); \
|
||||
echo "" $(DSPOUT); \
|
||||
echo "SOURCE=.\\"$$file $(DSPOUT); \
|
||||
echo "# End Source File" $(DSPOUT); \
|
||||
done; \
|
||||
echo "# End Group" $(DSPOUT); \
|
||||
echo "# Begin Group \"Header Files\"" $(DSPOUT); \
|
||||
for file in $(WIN32HEADERS); do \
|
||||
echo "# Begin Source File" $(DSPOUT); \
|
||||
echo "" $(DSPOUT); \
|
||||
echo "SOURCE=.\\"$$file $(DSPOUT); \
|
||||
echo "# End Source File" $(DSPOUT); \
|
||||
done; \
|
||||
echo "# End Group" $(DSPOUT); \
|
||||
cat $(srcdir)/msvc/msvcproj.foot $(DSPOUT) )
|
||||
|
||||
$(VCPROJ8): msvc/vc8proj.head msvc/vc8proj.foot Makefile.am
|
||||
echo "creating $(VCPROJ8)"
|
||||
@(cp $(srcdir)/msvc/vc8proj.head $(VCPROJ8); \
|
||||
for file in $(WIN32SOURCES); do \
|
||||
myfile=`echo $$file | sed -e 's|/|\\\\|g'`; \
|
||||
echo "<File RelativePath=\""$$myfile"\"></File>" $(VCPROJOUT8); \
|
||||
done; \
|
||||
echo "</Filter><Filter Name=\"Header Files\">" $(VCPROJOUT8); \
|
||||
for file in $(WIN32HEADERS); do \
|
||||
myfile=`echo $$file | sed -e 's|/|\\\\|g'`; \
|
||||
echo "<File RelativePath=\""$$myfile"\"></File>" $(VCPROJOUT8); \
|
||||
done; \
|
||||
cat $(srcdir)/msvc/vc8proj.foot $(VCPROJOUT8) )
|
||||
|
||||
$(VCPROJ9): msvc/vc9proj.head msvc/vc9proj.foot Makefile.am
|
||||
echo "creating $(VCPROJ9)"
|
||||
@(cp $(srcdir)/msvc/vc9proj.head $(VCPROJ9); \
|
||||
for file in $(WIN32SOURCES); do \
|
||||
myfile=`echo $$file | sed -e 's|/|\\\\|g'`; \
|
||||
echo "<File RelativePath=\""$$myfile"\"></File>" $(VCPROJOUT9); \
|
||||
done; \
|
||||
echo "</Filter><Filter Name=\"Header Files\">" $(VCPROJOUT9); \
|
||||
for file in $(WIN32HEADERS); do \
|
||||
myfile=`echo $$file | sed -e 's|/|\\\\|g'`; \
|
||||
echo "<File RelativePath=\""$$myfile"\"></File>" $(VCPROJOUT9); \
|
||||
done; \
|
||||
cat $(srcdir)/msvc/vc9proj.foot $(VCPROJOUT9) )
|
||||
|
||||
$(srcdir)/msvc/broadvoice.h: broadvoice.h.in
|
||||
echo "creating $(srcdir)/msvc/broadvoice.h"
|
||||
@sed -e "s/#define _BROADVOICE_H_/#define _BROADVOICE_H_\n\n#define __inline__ __inline\n#pragma warning(disable:4200)/" \
|
||||
-e "s/\@BROADVOICE_USE_FIXED_POINT\@/#undef BROADVOICE_USE_FIXED_POINT/" \
|
||||
-e "s/\@BROADVOICE_MISALIGNED_ACCESS_FAILS\@/#undef BROADVOICE_MISALIGNED_ACCESS_FAILS/" \
|
||||
-e "s/\@BROADVOICE_USE_EXPORT_CAPABILITY\@/#define BROADVOICE_USE_EXPORT_CAPABILITY 1/" \
|
||||
-e "s/\@INSERT_INTTYPES_HEADER\@/#include <msvc\/inttypes.h>/" \
|
||||
-e "s/\@INSERT_MATH_HEADER\@/#include <math.h>/" $(srcdir)/broadvoice.h.in > $(srcdir)/msvc/broadvoice.h
|
||||
|
||||
broadvoice/version.h:
|
||||
mkdir -p $(@D)
|
||||
NOWDATE=`date --utc +"%Y%m%d"` ; \
|
||||
NOWTIME=`date --utc +"%H%M%S"` ; \
|
||||
sed 's/$$BROADVOICE_RELEASE_DATE/'$$NOWDATE'/;s/$$BROADVOICE_RELEASE_TIME/'$$NOWTIME'/' \
|
||||
<$(srcdir)/broadvoice/version.h.in >$@
|
||||
|
||||
dist-hook: broadvoice/version.h
|
|
@ -1,89 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* bitpack16.c -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "broadvoice.h"
|
||||
#include "bv16strct.h"
|
||||
#include "bitstream.h"
|
||||
#include "bitpack16.h"
|
||||
|
||||
/*
|
||||
* The following is the bit table within the bit structure for
|
||||
* BroadVoice16
|
||||
*
|
||||
* int16_t bit_table[] =
|
||||
* {
|
||||
* 7, 7, // LSP
|
||||
* 7, // Pitch Lag
|
||||
* 5, // Pitch Gain
|
||||
* 4, // Excitation Vector Log-Gain
|
||||
* 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 // Excitation Vector
|
||||
* };
|
||||
*/
|
||||
|
||||
int bv16_bitpack(uint8_t *PackedStream, struct BV16_Bit_Stream *BitStruct)
|
||||
{
|
||||
bitstream_state_t bs;
|
||||
uint8_t *stream;
|
||||
int i;
|
||||
|
||||
stream = PackedStream;
|
||||
bitstream_init(&bs);
|
||||
bitstream_put(&bs, &stream, BitStruct->lspidx[0], 7);
|
||||
bitstream_put(&bs, &stream, BitStruct->lspidx[1], 7);
|
||||
bitstream_put(&bs, &stream, BitStruct->ppidx, 7);
|
||||
bitstream_put(&bs, &stream, BitStruct->bqidx, 5);
|
||||
bitstream_put(&bs, &stream, BitStruct->gidx, 4);
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
bitstream_put(&bs, &stream, BitStruct->qvidx[i], 5);
|
||||
bitstream_flush(&bs, &stream);
|
||||
return stream - PackedStream;
|
||||
}
|
||||
|
||||
void bv16_bitunpack(const uint8_t *PackedStream, struct BV16_Bit_Stream *BitStruct)
|
||||
{
|
||||
bitstream_state_t bs;
|
||||
const uint8_t *stream;
|
||||
int i;
|
||||
|
||||
stream = PackedStream;
|
||||
bitstream_init(&bs);
|
||||
|
||||
BitStruct->lspidx[0] = (int16_t) bitstream_get(&bs, &stream, 7);
|
||||
BitStruct->lspidx[1] = (int16_t) bitstream_get(&bs, &stream, 7);
|
||||
BitStruct->ppidx = (int16_t) bitstream_get(&bs, &stream, 7);
|
||||
BitStruct->bqidx = (int16_t) bitstream_get(&bs, &stream, 5);
|
||||
BitStruct->gidx = (int16_t) bitstream_get(&bs, &stream, 4);
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
BitStruct->qvidx[i] = (int16_t) bitstream_get(&bs, &stream, 5);
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* bitpack16.h -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bitpack16.h,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
#if !defined(_BITPACK16_H_)
|
||||
#define _BITPACK16_H_
|
||||
|
||||
int bv16_bitpack(uint8_t *PackedStream, struct BV16_Bit_Stream *BitStruct);
|
||||
void bv16_bitunpack(const uint8_t *PackedStream, struct BV16_Bit_Stream *BitStruct);
|
||||
|
||||
#endif
|
|
@ -1,94 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* bitpack32.c -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "broadvoice.h"
|
||||
#include "bv32strct.h"
|
||||
#include "bitstream.h"
|
||||
#include "bitpack32.h"
|
||||
|
||||
/*
|
||||
* The following is the bit table within the bit structure for
|
||||
* BroadVoice32
|
||||
*
|
||||
* int16_t bit_table[] =
|
||||
* {
|
||||
* 7, 5, 5, // LSP
|
||||
* 8, // Pitch Lag
|
||||
* 5, // Pitch Gain
|
||||
* 5, 5, // Excitation Vector Log-Gain
|
||||
* 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, // Excitation Vector 1st subframe
|
||||
* 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 // Excitation Vector 2nd subframe
|
||||
* };
|
||||
*/
|
||||
|
||||
int bv32_bitpack(uint8_t *PackedStream, struct BV32_Bit_Stream *BitStruct)
|
||||
{
|
||||
bitstream_state_t bs;
|
||||
uint8_t *stream;
|
||||
int i;
|
||||
|
||||
stream = PackedStream;
|
||||
bitstream_init(&bs);
|
||||
bitstream_put(&bs, &stream, BitStruct->lspidx[0], 7);
|
||||
bitstream_put(&bs, &stream, BitStruct->lspidx[1], 5);
|
||||
bitstream_put(&bs, &stream, BitStruct->lspidx[2], 5);
|
||||
bitstream_put(&bs, &stream, BitStruct->ppidx, 8);
|
||||
bitstream_put(&bs, &stream, BitStruct->bqidx, 5);
|
||||
bitstream_put(&bs, &stream, BitStruct->gidx[0], 5);
|
||||
bitstream_put(&bs, &stream, BitStruct->gidx[1], 5);
|
||||
for (i = 0; i < 20; i++)
|
||||
bitstream_put(&bs, &stream, BitStruct->qvidx[i], 6);
|
||||
bitstream_flush(&bs, &stream);
|
||||
return stream - PackedStream;
|
||||
}
|
||||
|
||||
void bv32_bitunpack(const uint8_t *PackedStream, struct BV32_Bit_Stream *BitStruct)
|
||||
{
|
||||
bitstream_state_t bs;
|
||||
const uint8_t *stream;
|
||||
int i;
|
||||
|
||||
stream = PackedStream;
|
||||
bitstream_init(&bs);
|
||||
|
||||
BitStruct->lspidx[0] = (int16_t) bitstream_get(&bs, &stream, 7);
|
||||
BitStruct->lspidx[1] = (int16_t) bitstream_get(&bs, &stream, 5);
|
||||
BitStruct->lspidx[2] = (int16_t) bitstream_get(&bs, &stream, 5);
|
||||
|
||||
BitStruct->ppidx = (int16_t) bitstream_get(&bs, &stream, 8);
|
||||
BitStruct->bqidx = (int16_t) bitstream_get(&bs, &stream, 5);
|
||||
BitStruct->gidx[0] = (int16_t) bitstream_get(&bs, &stream, 5);
|
||||
BitStruct->gidx[1] = (int16_t) bitstream_get(&bs, &stream, 5);
|
||||
|
||||
for (i = 0; i < 20; i++)
|
||||
BitStruct->qvidx[i] = (int16_t) bitstream_get(&bs, &stream, 6);
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* bitpack32.h -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bitpack32.h,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
#if !defined(_BITPACK32_H_)
|
||||
#define _BITPACK32_H_
|
||||
|
||||
int bv32_bitpack(uint8_t *PackedStream, struct BV32_Bit_Stream *BitStruct);
|
||||
void bv32_bitunpack(const uint8_t *PackedStream, struct BV32_Bit_Stream *BitStruct);
|
||||
|
||||
#endif
|
|
@ -1,123 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* bitstream.c -
|
||||
*
|
||||
* Copyright 2009 by Steve Underwood <steveu@coppice.org>
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bitstream.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "bitstream.h"
|
||||
|
||||
void bitstream_put(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits)
|
||||
{
|
||||
if (bits < 32)
|
||||
value &= ((1 << bits) - 1);
|
||||
if (bits > 24)
|
||||
{
|
||||
/* We can't deal with this many bits in one go. Split up the operation */
|
||||
bits -= 8;
|
||||
s->bitstream = (s->bitstream << bits) | (value >> 8);
|
||||
s->residue += bits;
|
||||
while (s->residue >= 8)
|
||||
{
|
||||
s->residue -= 8;
|
||||
*(*c)++ = (uint8_t) ((s->bitstream >> s->residue) & 0xFF);
|
||||
}
|
||||
bits = 8;
|
||||
value &= 0xFF;
|
||||
}
|
||||
s->bitstream = (s->bitstream << bits) | value;
|
||||
s->residue += bits;
|
||||
while (s->residue >= 8)
|
||||
{
|
||||
s->residue -= 8;
|
||||
*(*c)++ = (uint8_t) ((s->bitstream >> s->residue) & 0xFF);
|
||||
}
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
uint32_t bitstream_get(bitstream_state_t *s, const uint8_t **c, int bits)
|
||||
{
|
||||
uint32_t x;
|
||||
|
||||
if (bits > 24)
|
||||
{
|
||||
/* We can't deal with this many bits in one go. Split up the operation */
|
||||
while (s->residue < 24)
|
||||
{
|
||||
s->bitstream = (s->bitstream << 8) | ((uint32_t) *(*c)++);
|
||||
s->residue += 8;
|
||||
}
|
||||
s->residue -= 24;
|
||||
bits -= 24;
|
||||
x = ((s->bitstream >> s->residue) & 0xFFFFFF) << bits;
|
||||
while (s->residue < bits)
|
||||
{
|
||||
s->bitstream = (s->bitstream << 8) | ((uint32_t) *(*c)++);
|
||||
s->residue += 8;
|
||||
}
|
||||
s->residue -= bits;
|
||||
x |= (s->bitstream >> s->residue) & ((1 << bits) - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
while (s->residue < bits)
|
||||
{
|
||||
s->bitstream = (s->bitstream << 8) | ((uint32_t) *(*c)++);
|
||||
s->residue += 8;
|
||||
}
|
||||
s->residue -= bits;
|
||||
x = (s->bitstream >> s->residue) & ((1 << bits) - 1);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
void bitstream_flush(bitstream_state_t *s, uint8_t **c)
|
||||
{
|
||||
if (s->residue > 0)
|
||||
{
|
||||
*(*c)++ = (uint8_t) ((s->bitstream << (8 - s->residue)) & 0xFF);
|
||||
s->residue = 0;
|
||||
}
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
bitstream_state_t *bitstream_init(bitstream_state_t *s)
|
||||
{
|
||||
if (s == NULL)
|
||||
return NULL;
|
||||
s->bitstream = 0;
|
||||
s->residue = 0;
|
||||
return s;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
/*- End of file ------------------------------------------------------------*/
|
|
@ -1,47 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* bitstream.c -
|
||||
*
|
||||
* Copyright 2009 by Steve Underwood <steveu@coppice.org>
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bitstream.h,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
#if !defined(_BITSTREAM_H_)
|
||||
#define _BITSTREAM_H_
|
||||
|
||||
/*! Bitstream handler state */
|
||||
typedef struct
|
||||
{
|
||||
/*! The bit stream. */
|
||||
uint32_t bitstream;
|
||||
/*! The residual bits in bitstream. */
|
||||
int residue;
|
||||
} bitstream_state_t;
|
||||
|
||||
void bitstream_put(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits);
|
||||
|
||||
uint32_t bitstream_get(bitstream_state_t *s, const uint8_t **c, int bits);
|
||||
|
||||
void bitstream_flush(bitstream_state_t *s, uint8_t **c);
|
||||
|
||||
bitstream_state_t *bitstream_init(bitstream_state_t *s);
|
||||
|
||||
#endif
|
||||
/*- End of file ------------------------------------------------------------*/
|
|
@ -1,123 +0,0 @@
|
|||
# Microsoft Developer Studio Project File - Name="g722_1" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=g722_1 - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "g722_1.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "g722_1.mak" CFG="g722_1 - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "g722_1 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "g722_1 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "g722_1 - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /D "_WINDLL" /FR /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /map /debug /machine:I386 /out:"Release/libg722_1.dll"
|
||||
|
||||
!ELSEIF "$(CFG)" == "g722_1 - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /FR /FD /GZ /c
|
||||
# SUBTRACT CPP /WX /YX
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"Debug/libg722_1.dll" /pdbtype:sept
|
||||
# SUBTRACT LINK32 /nodefaultlib
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "g722_1 - Win32 Release"
|
||||
# Name "g722_1 - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\msvc/gettimeofday.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\broadvoice/broadvoice.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\broadvoice/version.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\broadvoice/private/broadvoice.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\broadvoice.h
|
||||
# End Source File
|
||||
# End Group
|
||||
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* broadvoice.h - The head guy amongst the headers
|
||||
*
|
||||
* Written by Steve Underwood <steveu@coppice.org>
|
||||
*
|
||||
* Copyright (C) 2009 Steve Underwood
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* $Id: broadvoice.h.in,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if !defined(_BROADVOICE_H_)
|
||||
#define _BROADVOICE_H_
|
||||
|
||||
@BROADVOICE_USE_FIXED_POINT@
|
||||
@BROADVOICE_MISALIGNED_ACCESS_FAILS@
|
||||
|
||||
@BROADVOICE_USE_EXPORT_CAPABILITY@
|
||||
|
||||
#include <stdlib.h>
|
||||
@INSERT_INTTYPES_HEADER@
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <time.h>
|
||||
@INSERT_MATH_HEADER@
|
||||
|
||||
#include <broadvoice/broadvoice.h>
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(BROADVOICE_EXPOSE_INTERNAL_STRUCTURES)
|
||||
#include <broadvoice/private/broadvoice.h>
|
||||
#endif
|
||||
/*- End of file ------------------------------------------------------------*/
|
|
@ -1,29 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbroadvoice", "libbroadvoice.vcproj", "{CF70F278-3364-4395-A2E1-23501C9B8AD2}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{1CED5987-A529-46DC-B30F-870D85FF9C94} = {1CED5987-A529-46DC-B30F-870D85FF9C94}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "at_dictionary_gen", "src\msvc\at_dictionary_gen.vcproj", "{1CED5987-A529-46DC-B30F-870D85FF9C94}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|Win32.Build.0 = Release|Win32
|
||||
{1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -1,197 +0,0 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C"
|
||||
Version="9.00"
|
||||
Name="libg722_1"
|
||||
ProjectGUID="{CF70F278-3364-4395-A2E1-23501C9B8AD2}"
|
||||
RootNamespace="libg722_1"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="src; src\g722_1; src\msvc"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBG722_1_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_TGMATH_H"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
ModuleDefinitionFile="src/msvc/g722_1.def"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="src; src\g722_1; src\msvc"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBG722_1_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_TGMATH_H"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
ModuleDefinitionFile="src/msvc/g722_1.def"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File RelativePath="msvc/gettimeofday.c"></File>
|
||||
</Filter><Filter Name="Header Files">
|
||||
<File RelativePath="broadvoice/broadvoice.h"></File>
|
||||
<File RelativePath="broadvoice/version.h"></File>
|
||||
<File RelativePath="broadvoice/private/broadvoice.h"></File>
|
||||
<File RelativePath="broadvoice.h"></File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -1,123 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* broadvoice.h -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: broadvoice.h,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
#if !defined(_BROADVOICE_BROADVOICE_H_)
|
||||
#define _BROADVOICE_BROADVOICE_H_
|
||||
|
||||
#if defined(_M_IX86) || defined(_M_X64)
|
||||
#if defined(BROADVOICE_EXPORTS)
|
||||
#define BV_DECLARE(type) __declspec(dllexport) type __stdcall
|
||||
#define BV_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl
|
||||
#define BV_DECLARE_DATA __declspec(dllexport)
|
||||
#else
|
||||
#define BV_DECLARE(type) __declspec(dllimport) type __stdcall
|
||||
#define BV_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl
|
||||
#define BV_DECLARE_DATA __declspec(dllimport)
|
||||
#endif
|
||||
#elif defined(BROADVOICE_USE_EXPORT_CAPABILITY) && (defined(__GNUC__) || defined(__SUNCC__))
|
||||
#define BV_DECLARE(type) __attribute__((visibility("default"))) type
|
||||
#define BV_DECLARE_NONSTD(type) __attribute__((visibility("default"))) type
|
||||
#define BV_DECLARE_DATA __attribute__((visibility("default")))
|
||||
#else
|
||||
#define BV_DECLARE(type) /**/ type
|
||||
#define BV_DECLARE_NONSTD(type) /**/ type
|
||||
#define BV_DECLARE_DATA /**/
|
||||
#endif
|
||||
|
||||
typedef struct bv16_encode_state_s bv16_encode_state_t;
|
||||
typedef struct bv16_decode_state_s bv16_decode_state_t;
|
||||
typedef struct bv32_encode_state_s bv32_encode_state_t;
|
||||
typedef struct bv32_decode_state_s bv32_decode_state_t;
|
||||
|
||||
#define BV16_FRAME_LEN 40
|
||||
#define BV32_FRAME_LEN 80
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
BV_DECLARE(bv16_encode_state_t *) bv16_encode_init(bv16_encode_state_t *s);
|
||||
|
||||
BV_DECLARE(int) bv16_encode(bv16_encode_state_t *cs,
|
||||
uint8_t *out,
|
||||
const int16_t amp[],
|
||||
int len);
|
||||
|
||||
BV_DECLARE(int) bv16_encode_release(bv16_encode_state_t *s);
|
||||
|
||||
BV_DECLARE(int) bv16_encode_free(bv16_encode_state_t *s);
|
||||
|
||||
|
||||
BV_DECLARE(bv16_decode_state_t *) bv16_decode_init(bv16_decode_state_t *s);
|
||||
|
||||
BV_DECLARE(int) bv16_decode(bv16_decode_state_t *s,
|
||||
int16_t amp[],
|
||||
const uint8_t *in,
|
||||
int len);
|
||||
|
||||
BV_DECLARE(int) bv16_fillin(bv16_decode_state_t *s,
|
||||
int16_t amp[],
|
||||
int len);
|
||||
|
||||
BV_DECLARE(int) bv16_decode_release(bv16_decode_state_t *s);
|
||||
|
||||
BV_DECLARE(int) bv16_decode_free(bv16_decode_state_t *s);
|
||||
|
||||
|
||||
BV_DECLARE(bv32_encode_state_t *) bv32_encode_init(bv32_encode_state_t *s);
|
||||
|
||||
BV_DECLARE(int) bv32_encode(bv32_encode_state_t *s,
|
||||
uint8_t *out,
|
||||
const int16_t amp[],
|
||||
int len);
|
||||
|
||||
BV_DECLARE(int) bv32_encode_release(bv32_encode_state_t *s);
|
||||
|
||||
BV_DECLARE(int) bv32_encode_free(bv32_encode_state_t *s);
|
||||
|
||||
|
||||
BV_DECLARE(bv32_decode_state_t *) bv32_decode_init(bv32_decode_state_t *s);
|
||||
|
||||
BV_DECLARE(int) bv32_decode(bv32_decode_state_t *s,
|
||||
int16_t amp[],
|
||||
const uint8_t *in,
|
||||
int len);
|
||||
|
||||
BV_DECLARE(int) bv32_fillin(bv32_decode_state_t *ds,
|
||||
int16_t amp[],
|
||||
int len);
|
||||
|
||||
BV_DECLARE(int) bv32_decode_release(bv32_decode_state_t *s);
|
||||
|
||||
BV_DECLARE(int) bv32_decode_free(bv32_decode_state_t *s);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/*- End of file ------------------------------------------------------------*/
|
|
@ -1,184 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* broadvoice.h - The head guy amongst the headers
|
||||
*
|
||||
* Written by Steve Underwood <steveu@coppice.org>
|
||||
*
|
||||
* Copyright (C) 2009 Steve Underwood
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* $Id: broadvoice.h,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if !defined(_BROADVOICE_PRIVATE_BROADVOICE_H_)
|
||||
#define _BROADVOICE_PRIVATE_BROADVOICE_H_
|
||||
|
||||
typedef double Float;
|
||||
|
||||
#define LPCO 8 /* LPC Order */
|
||||
#define HPO 2 /* Front end 150Hz high-pass filter order */
|
||||
#define DFO 4
|
||||
|
||||
#define BV16_FRSZ 40 /* Frame size */
|
||||
#define BV16_MAXPP 137 /* MAXimum Pitch Period */
|
||||
#define BV16_PWSZ 120 /* Pitch analysis Window SiZe */
|
||||
#define BV16_XQOFF (BV16_MAXPP + 1) /* xq() offset before current subframe */
|
||||
#define BV16_XOFF (BV16_MAXPP + 1) /* Offset for x() frame */
|
||||
#define BV16_LTMOFF (BV16_MAXPP + 1) /* Long-Term filter Memory OFFset */
|
||||
#define BV16_LSPPORDER 8 /* LSP MA Predictor ORDER */
|
||||
#define BV16_NSTORDER 8 /* Pole-zero NFC shaping filter */
|
||||
#define BV16_LGPORDER 8 /* Log-Gain Predictor OODER */
|
||||
#define BV16_DECF 4 /* DECimation Factor for coarse pitch period search */
|
||||
#define BV16_XDOFF (BV16_LXD - BV16_FRSZD)
|
||||
|
||||
#define BV16_FRSZD (BV16_FRSZ/BV16_DECF) /* FRame SiZe in DECF:1 lowband domain */
|
||||
#define BV16_PWSZD (BV16_PWSZ/BV16_DECF) /* Pitch ana. Window SiZe in DECF:1 domain */
|
||||
#define BV16_MAXPPD (BV16_MAXPP/BV16_DECF) /* MAX Pitch in DECF:1, if MAXPP!=4n, ceil() */
|
||||
#define BV16_LXD (BV16_MAXPPD + 1 + BV16_PWSZD)
|
||||
|
||||
#define BV32_FRSZ 80 /* Frame size */
|
||||
#define BV32_MAXPP 265 /* MAXimum Pitch Period */
|
||||
#define BV32_PWSZ 240 /* Pitch analysis Window SiZe for 8kHz lowband */
|
||||
#define BV32_XOFF (BV32_MAXPP + 1) /* offset for x() frame */
|
||||
#define BV32_LTMOFF (BV32_MAXPP + 1) /* Long-Term filter Memory OFFset */
|
||||
#define BV32_LSPPORDER 8 /* LSP MA Predictor ORDER */
|
||||
#define BV32_PFO 1 /* Preemphasis filter order */
|
||||
#define BV32_LGPORDER 16 /* Log-Gain Predictor OODER */
|
||||
#define BV32_DECF 8 /* DECimation Factor for coarse pitch period search */
|
||||
#define BV32_XDOFF (BV32_LXD - BV32_FRSZD)
|
||||
|
||||
#define BV32_FRSZD (BV32_FRSZ/BV32_DECF) /* FRame SiZe in DECF:1 lowband domain */
|
||||
#define BV32_PWSZD (BV32_PWSZ/BV32_DECF) /* Pitch ana. Window SiZe in DECF:1 domain */
|
||||
#define BV32_MAXPPD (BV32_MAXPP/BV32_DECF) /* MAX Pitch in DECF:1, if MAXPP!=4n, ceil() */
|
||||
#define BV32_LXD (BV32_MAXPPD + 1 + BV32_PWSZD)
|
||||
|
||||
struct bv16_decode_state_s
|
||||
{
|
||||
Float stsym[LPCO];
|
||||
Float ltsym[BV16_LTMOFF];
|
||||
Float lsppm[LPCO*BV16_LSPPORDER];
|
||||
Float lgpm[BV16_LGPORDER];
|
||||
Float lsplast[LPCO];
|
||||
Float prevlg[2];
|
||||
Float lmax; /* level-adaptation */
|
||||
Float lmin;
|
||||
Float lmean;
|
||||
Float x1;
|
||||
Float level;
|
||||
int16_t pp_last;
|
||||
int16_t ngfae;
|
||||
Float bq_last[3];
|
||||
int16_t nggalgc;
|
||||
Float estl_alpha_min;
|
||||
int16_t cfecount;
|
||||
uint32_t idum;
|
||||
Float E;
|
||||
Float per;
|
||||
Float atplc[LPCO + 1];
|
||||
Float ma_a;
|
||||
Float b_prv[2];
|
||||
Float xq[BV16_XQOFF];
|
||||
int pp_prv;
|
||||
};
|
||||
|
||||
struct bv16_encode_state_s
|
||||
{
|
||||
Float x[BV16_XOFF]; /* 8kHz down-sampled signal memory */
|
||||
Float xwd[BV16_XDOFF]; /* memory of DECF:1 decimated version of xw() */
|
||||
Float dq[BV16_XOFF]; /* quantized short-term pred error */
|
||||
Float dfm[DFO]; /* decimated xwd() filter memory */
|
||||
Float stpem[LPCO]; /* ST Pred. Error filter memory */
|
||||
Float stwpm[LPCO]; /* ST Weighting all-Pole Memory */
|
||||
Float stsym[LPCO]; /* ST Synthesis filter Memory */
|
||||
Float ltsym[BV16_MAXPP + 1 + BV16_FRSZ]; /* long-term synthesis filter memory */
|
||||
Float ltnfm[BV16_MAXPP + 1 + BV16_FRSZ]; /* long-term noise feedback filter memory */
|
||||
Float lsplast[LPCO];
|
||||
Float lsppm[LPCO*BV16_LSPPORDER]; /* LSP Predictor Memory */
|
||||
Float lgpm[BV16_LGPORDER];
|
||||
Float hpfzm[HPO];
|
||||
Float hpfpm[HPO];
|
||||
Float prevlg[2];
|
||||
Float lmax; /* level-adaptation */
|
||||
Float lmin;
|
||||
Float lmean;
|
||||
Float x1;
|
||||
Float level;
|
||||
int cpplast; /* pitch period pf the previous frame */
|
||||
Float old_A[LPCO + 1];
|
||||
Float stnfz[BV16_NSTORDER];
|
||||
Float stnfp[BV16_NSTORDER];
|
||||
};
|
||||
|
||||
struct bv32_decode_state_s
|
||||
{
|
||||
Float stsym[LPCO];
|
||||
Float ltsym[BV32_LTMOFF];
|
||||
Float lsppm[LPCO*BV32_LSPPORDER];
|
||||
Float lgpm[BV32_LGPORDER];
|
||||
Float lsplast[LPCO];
|
||||
Float dezfm[BV32_PFO];
|
||||
Float depfm[BV32_PFO];
|
||||
int16_t cfecount;
|
||||
uint32_t idum;
|
||||
Float E;
|
||||
Float scplcg;
|
||||
Float per;
|
||||
Float atplc[LPCO + 1];
|
||||
int16_t pp_last;
|
||||
Float prevlg[2];
|
||||
Float lgq_last;
|
||||
Float bq_last[3];
|
||||
Float lmax; /* level-adaptation */
|
||||
Float lmin;
|
||||
Float lmean;
|
||||
Float x1;
|
||||
Float level;
|
||||
int16_t nclglim;
|
||||
int16_t lctimer;
|
||||
};
|
||||
|
||||
struct bv32_encode_state_s
|
||||
{
|
||||
Float x[BV32_XOFF];
|
||||
Float xwd[BV32_XDOFF]; /* Memory of DECF:1 decimated version of xw() */
|
||||
Float dq[BV32_XOFF]; /* Quantized short-term pred error */
|
||||
Float dfm[DFO]; /* Decimated xwd() filter memory */
|
||||
Float stpem[LPCO]; /* ST Pred. Error filter memory, low-band */
|
||||
Float stwpm[LPCO]; /* ST Weighting all-Pole Memory, low-band */
|
||||
Float stnfm[LPCO]; /* ST Noise Feedback filter Memory, Lowband */
|
||||
Float stsym[LPCO]; /* ST Synthesis filter Memory, Lowband */
|
||||
Float ltsym[BV32_MAXPP + 1 + BV32_FRSZ]; /* Long-term synthesis filter memory */
|
||||
Float ltnfm[BV32_MAXPP + 1 + BV32_FRSZ]; /* Long-term noise feedback filter memory */
|
||||
Float lsplast[LPCO];
|
||||
Float lsppm[LPCO*BV32_LSPPORDER]; /* LSP Predictor Memory */
|
||||
Float lgpm[BV32_LGPORDER];
|
||||
Float hpfzm[HPO];
|
||||
Float hpfpm[HPO];
|
||||
Float prevlg[2];
|
||||
Float lmax; /* level-adaptation */
|
||||
Float lmin;
|
||||
Float lmean;
|
||||
Float x1;
|
||||
Float level;
|
||||
int cpplast; /* pitch period pf the previous frame */
|
||||
Float allast[LPCO + 1];
|
||||
};
|
||||
|
||||
#endif
|
||||
/*- End of file ------------------------------------------------------------*/
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* version.h.in - A tag file, so the exact installed revision can be assertained.
|
||||
*
|
||||
* Written by Steve Underwood <steveu@coppice.org>
|
||||
*
|
||||
* Copyright (C) 2009 Steve Underwood
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: version.h.in,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
#if !defined(_BROADVOICE_VERSION_H_)
|
||||
#define _BROADVOICE_VERSION_H_
|
||||
|
||||
/* The date and time of the version are in UTC form. */
|
||||
|
||||
#define BROADVOICE_RELEASE_DATE 20091119
|
||||
#define BROADVOICE_RELEASE_TIME 131751
|
||||
|
||||
#endif
|
||||
/*- End of file ------------------------------------------------------------*/
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* version.h.in - A tag file, so the exact installed revision can be assertained.
|
||||
*
|
||||
* Written by Steve Underwood <steveu@coppice.org>
|
||||
*
|
||||
* Copyright (C) 2009 Steve Underwood
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: version.h.in,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
#if !defined(_BROADVOICE_VERSION_H_)
|
||||
#define _BROADVOICE_VERSION_H_
|
||||
|
||||
/* The date and time of the version are in UTC form. */
|
||||
|
||||
#define BROADVOICE_RELEASE_DATE $BROADVOICE_RELEASE_DATE
|
||||
#define BROADVOICE_RELEASE_TIME $BROADVOICE_RELEASE_TIME
|
||||
|
||||
#endif
|
||||
/*- End of file ------------------------------------------------------------*/
|
|
@ -1,154 +0,0 @@
|
|||
/*****************************************************************************/
|
||||
/* BroadVoice(R)16 (BV16) Floating-Point ANSI-C Source Code */
|
||||
/* Revision Date: August 19, 2009 */
|
||||
/* Version 1.0 */
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Copyright 2000-2009 Broadcom Corporation */
|
||||
/* */
|
||||
/* This software is provided under the GNU Lesser General Public License, */
|
||||
/* version 2.1, as published by the Free Software Foundation ("LGPL"). */
|
||||
/* This program is distributed in the hope that it will be useful, but */
|
||||
/* WITHOUT ANY SUPPORT OR WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the LGPL for */
|
||||
/* more details. A copy of the LGPL is available at */
|
||||
/* http://www.broadcom.com/licenses/LGPLv2.1.php, */
|
||||
/* or by writing to the Free Software Foundation, Inc., */
|
||||
/* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
bv16cnst.h : BV16 constants
|
||||
|
||||
$Log: bv16cnst.h,v $
|
||||
Revision 1.1.1.1 2009/11/19 12:10:48 steveu
|
||||
Start from Broadcom's code
|
||||
|
||||
Revision 1.1.1.1 2009/11/17 14:06:02 steveu
|
||||
start
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#include "typedef.h"
|
||||
|
||||
#ifndef BV16CNST_H
|
||||
#define BV16CNST_H
|
||||
|
||||
|
||||
/* ----- Basic Codec Parameters ----- */
|
||||
#define FRSZ 40 /* frame size */
|
||||
#define WINSZ 160 /* lpc analysis WINdow SiZe */
|
||||
#define MAXPP 137 /* MAXimum Pitch Period */
|
||||
#define MINPP 10 /* MINimum Pitch Period */
|
||||
#define PWSZ 120 /* Pitch analysis Window SiZe */
|
||||
#define MAXPP1 (MAXPP+1)/* MAXimum Pitch Period + 1 */
|
||||
|
||||
/* Quantization parameters */
|
||||
#define VDIM 4 /* excitation vector dimension */
|
||||
#define CBSZ 16 /* excitation codebook size */
|
||||
#define PPCBSZ 32 /* pitch predictor codebook size */
|
||||
#define LGPORDER 8 /* Log-Gain Predictor OODER */
|
||||
#define LGPECBSZ 16 /* Log-Gain Prediction Error CodeBook SiZe */
|
||||
#define LSPPORDER 8 /* LSP MA Predictor ORDER */
|
||||
#define LSPECBSZ1 128 /* codebook size of 1st-stage LSP VQ */
|
||||
#define LSPECBSZ2 64 /* codebook size of 2nd-stage LSP VQ; 1-bit for sign */
|
||||
|
||||
#define INVFRSZ (1./(Float)FRSZ)
|
||||
|
||||
/* Excitation gain quantization */
|
||||
#define LGMEAN 11.45752 /* log2-gain mean */
|
||||
#define GPO 8 /* order of MA prediction */
|
||||
#define NG 18 /* number of relative gain bins */
|
||||
#define GLB -24. /* lower relative gain bound */
|
||||
#define NGC 12 /* number of gain change bins */
|
||||
#define GCLB -8. /* lower gain change bound */
|
||||
#define Minlg 0. /* minimum log-gain */
|
||||
#define TMinlg 1. /* minimum linear gain */
|
||||
#define LGCBSZ 16 /* size of codebook */
|
||||
|
||||
/* Definitions for periodicity to gain scaling mapping */
|
||||
#define ScPLCGmin 0.1
|
||||
#define ScPLCGmax 0.9
|
||||
#define PePLCGmin 0.5
|
||||
#define PePLCGmax 0.9
|
||||
#define ScPLCG_b ((ScPLCGmin-ScPLCGmax)/(PePLCGmax-PePLCGmin))
|
||||
#define ScPLCG_a (ScPLCGmin-ScPLCG_b*PePLCGmax)
|
||||
#define HoldPLCG 8
|
||||
#define AttnPLCG 50
|
||||
#define AttnFacPLCG (1.0/(Float)AttnPLCG)
|
||||
|
||||
/* Level Estimation */
|
||||
#define estl_alpha (4095./4096.)
|
||||
#define estl_alpha1 (255./256.)
|
||||
#define estl_beta (511./512.)
|
||||
#define estl_beta1 (1.-estl_beta)
|
||||
#define estl_a (255./256)
|
||||
#define estl_a1 (1-estl_a)
|
||||
#define estl_TH 0.2
|
||||
#define Nfdm 100 /* Max number of frames with fast decay of Lmin */
|
||||
|
||||
/* Log-Gain Limitation */
|
||||
#define LGLB -24 /* Relative (to input level) Log-Gain Lower Bound */
|
||||
#define LGCLB -8 /* Log-Gain Change Lower Bound */
|
||||
#define NGB 18 /* Number of Gain Bins */
|
||||
#define NGCB 12 /* Number of Gain Change Bins */
|
||||
|
||||
/* Buffer offsets and sizes */
|
||||
#define XOFF MAXPP1 /* offset for x() frame */
|
||||
#define LX (XOFF+FRSZ) /* Length of x() buffer */
|
||||
#define XQOFF (MAXPP1) /* xq() offset before current subframe */
|
||||
#define LXQ (XQOFF+FRSZ) /* Length of xq() buffer */
|
||||
#define LTMOFF (MAXPP1) /* Long-Term filter Memory OFFset */
|
||||
|
||||
/* Long-term postfilter */
|
||||
#define DPPQNS 4 /* Delta pitch period for search */
|
||||
#define NINT 20 /* length of filter interpolation */
|
||||
#define ATHLD1 0.55 /* threshold on normalized pitch correlation */
|
||||
#define ATHLD2 0.80 /* threshold on normalized pitch correlation */
|
||||
#define ScLTPF 0.3 /* scaling of LTPF coefficient */
|
||||
|
||||
/* coarse pitch search */
|
||||
#define cpp_Qvalue 2
|
||||
#define cpp_scale (1<<cpp_Qvalue)
|
||||
#define MAX_NPEAKS 7
|
||||
#define MPTH4 0.3 /* value to use for MPTH[] with index >= 4 */
|
||||
#define DEVTH 0.25 /* pitch period DEViation THreshold */
|
||||
#define TH1 0.73 /* first threshold for cor*cor/energy */
|
||||
#define TH2 0.4 /* second threshold for cor*cor/energy */
|
||||
#define LPTH1 0.79 /* Last Pitch cor*cor/energy THreshold 1 */
|
||||
#define LPTH2 0.43 /* Last Pitch cor*cor/energy THreshold 2 */
|
||||
#define MPDTH 0.065 /* Multiple Pitch Deviation THreshold */
|
||||
#define SMDTH 0.095 /* Sub-Multiple pitch Deviation THreshold */
|
||||
#define SMDTH1 (1.0-SMDTH)
|
||||
#define SMDTH2 (1.0+SMDTH)
|
||||
#define MPR1 (1.0-MPDTH) /* Multiple Pitch Range lower threshold */
|
||||
#define MPR2 (1.0+MPDTH) /* Multiple Pitch Range upper threshold */
|
||||
|
||||
/* Decimation parameters */
|
||||
#define DECF 4 /* DECimation Factor for coarse pitch period search */
|
||||
#define FRSZD (FRSZ/DECF) /* FRame SiZe in DECF:1 lowband domain */
|
||||
#define MAXPPD (MAXPP/DECF) /* MAX Pitch in DECF:1, if MAXPP!=4n, ceil() */
|
||||
#define MINPPD ((int) (MINPP/DECF)) /* MINimum Pitch Period in DECF:1 */
|
||||
#define PWSZD (PWSZ/DECF) /* Pitch ana. Window SiZe in DECF:1 domain */
|
||||
#define DFO 4
|
||||
#define MAXPPD1 (MAXPPD + 1)
|
||||
#define LXD (MAXPPD1 + PWSZD)
|
||||
#define XDOFF (LXD - FRSZD)
|
||||
#define HMAXPPD (MAXPPD/2)
|
||||
#define M1 (MINPPD - 1)
|
||||
#define M2 MAXPPD1
|
||||
#define HDECF (DECF/2)
|
||||
#define INVDECF (1.0F/(float)(DECF)) /* INVerse of DECF (decimation factor) */
|
||||
|
||||
/* Front-end 150 Hz highpass filter */
|
||||
#define HPO 2 /* High-pass filter order */
|
||||
|
||||
/* LPC weighting filter */
|
||||
#define LTWFL 0.5
|
||||
|
||||
/* pole-zero NFC shaping filter */
|
||||
#define NSTORDER 8
|
||||
|
||||
#endif /* BV16CNST_H */
|
|
@ -1,355 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* bv16coarse_pitch.c - Coarse pitch search
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv16coarse_pitch.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bv16cnst.h"
|
||||
#include "utility.h"
|
||||
#include "bv16externs.h"
|
||||
|
||||
int coarsepitch(
|
||||
Float *xw,
|
||||
Float *xwdm,
|
||||
Float *dfm, /* (i/o) ellipse low pass filter memory */
|
||||
int cpplast)
|
||||
{
|
||||
Float xwd[LXD];
|
||||
Float cor[MAXPPD1];
|
||||
Float cor2[MAXPPD1];
|
||||
Float energy[MAXPPD1];
|
||||
Float cor2i[HMAXPPD];
|
||||
Float energyi[HMAXPPD];
|
||||
Float mplth;
|
||||
Float tmp[DFO + FRSZ];
|
||||
Float threshold;
|
||||
Float *fp0, *fp1, *fp2, *fp3, s, t, a, b, c, deltae;
|
||||
Float cor2max, energymax, cor2m, energym, ci, eni;
|
||||
int i, j, k, n, npeaks, imax, im, idx[HMAXPPD], plag[HMAXPPD];
|
||||
int cpp, maxdev, flag, mpflag;
|
||||
|
||||
/* reset local buffers */
|
||||
Fzero(cor, MAXPPD1);
|
||||
Fzero(energy, MAXPPD1);
|
||||
|
||||
/* LOWPASS FILTER xw() TO 800 Hz; SHIFT & OUTPUT INTO xwd() */
|
||||
|
||||
/* copy xwd[] from memory to buffer */
|
||||
Fcopy(xwd, xwdm, XDOFF);
|
||||
|
||||
/* copy memory to temp buffer */
|
||||
Fcopy(tmp, dfm, DFO);
|
||||
|
||||
/* AP and AZ filtering and decimation */
|
||||
fp0 = xwd + XDOFF;
|
||||
fp1 = tmp + DFO;
|
||||
fp3 = xw;
|
||||
for (i = 0; i < FRSZD; i++)
|
||||
{
|
||||
for (k = 0; k < DECF; k++)
|
||||
{
|
||||
t = *fp3++;
|
||||
fp2 = fp1 - 1;
|
||||
for (j = 0; j < DFO; j++)
|
||||
t -= bv16_adf[j + 1]*(*fp2--);
|
||||
*fp1++ = t;
|
||||
}
|
||||
fp2 = fp1 - 1;
|
||||
t = bv16_bdf[0]*(*fp2--);
|
||||
for (j = 0; j < DFO; j++)
|
||||
t += bv16_bdf[j + 1]*(*fp2--);
|
||||
*fp0++ = t;
|
||||
}
|
||||
|
||||
/* copy temp buffer to memory */
|
||||
fp1 -= DFO;
|
||||
for (i = 0; i < DFO; i++)
|
||||
dfm[i] = *fp1++;
|
||||
|
||||
/* update xwd() memory */
|
||||
Fcopy(xwdm, xwd + FRSZD, XDOFF);
|
||||
|
||||
/* COMPUTE CORRELATION & ENERGY OF PREDICTION BASIS VECTOR */
|
||||
fp0 = xwd + MAXPPD1;
|
||||
fp1 = xwd + MAXPPD1 - M1;
|
||||
s = t = 0.0;
|
||||
for (i = 0; i < (LXD - MAXPPD1); i++)
|
||||
{
|
||||
s += (*fp1)*(*fp1);
|
||||
t += (*fp0++)*(*fp1++);
|
||||
}
|
||||
energy[M1 - 1] = s;
|
||||
cor[M1 - 1] = t;
|
||||
if (t > 0.0F)
|
||||
cor2[M1 - 1] = t*t;
|
||||
else
|
||||
cor2[M1 - 1] = -t*t;
|
||||
|
||||
|
||||
fp2 = xwd + LXD - M1 - 1;
|
||||
fp3 = xwd + MAXPPD1 - M1 - 1;
|
||||
|
||||
for (i = M1; i < M2; i++)
|
||||
{
|
||||
fp0 = xwd + MAXPPD1;
|
||||
fp1 = xwd + MAXPPD1 - i - 1;
|
||||
t = 0.0;
|
||||
for (j = 0; j < (LXD - MAXPPD1); j++)
|
||||
t += (*fp0++)*(*fp1++);
|
||||
cor[i] = t;
|
||||
if (t > 0.0F)
|
||||
cor2[i] = t*t;
|
||||
else
|
||||
cor2[i] = -t*t;
|
||||
s = s - (*fp2)*(*fp2) + (*fp3)*(*fp3);
|
||||
fp2--;
|
||||
fp3--;
|
||||
energy[i] = s;
|
||||
}
|
||||
|
||||
/* FIND POSITIVE COR*COR/ENERGY PEAKS */
|
||||
npeaks = 0;
|
||||
n = MINPPD - 1;
|
||||
while ((n < MAXPPD) && (npeaks < MAX_NPEAKS))
|
||||
{
|
||||
if ((cor2[n]*energy[n - 1] > cor2[n - 1]*energy[n])
|
||||
&&
|
||||
(cor2[n]*energy[n + 1] > cor2[n + 1]*energy[n])
|
||||
&&
|
||||
(cor2[n] > 0))
|
||||
{
|
||||
idx[npeaks] = n;
|
||||
npeaks++;
|
||||
}
|
||||
n++;
|
||||
}
|
||||
|
||||
/* RETURN EARLY IF THERE IS NO PEAK OR ONLY ONE PEAK */
|
||||
if (npeaks == 0) /* if there are no positive peak, */
|
||||
return MINPPD*cpp_scale; /* minimum pitch period in decimated domain */
|
||||
if (npeaks == 1) /* if there is exactly one peak, */
|
||||
return (idx[0] + 1)*cpp_scale; /* the time lag for this single peak */
|
||||
|
||||
/* IF PROGRAM PROCEEDS TO HERE, THERE ARE 2 OR MORE PEAKS */
|
||||
cor2max = -1e30;
|
||||
energymax = 1.0F;
|
||||
imax = 0;
|
||||
for (i = 0; i < npeaks; i++)
|
||||
{
|
||||
/* USE QUADRATIC INTERPOLATION TO FIND THE INTERPOLATED cor[] AND
|
||||
energy[] CORRESPONDING TO INTERPOLATED PEAK OF cor2[]/energy[] */
|
||||
/* first calculate coefficients of y(x)=ax^2+bx+c; */
|
||||
n = idx[i];
|
||||
a = 0.5F*(cor[n + 1] + cor[n - 1]) - cor[n];
|
||||
b = 0.5F*(cor[n + 1] - cor[n - 1]);
|
||||
c = cor[n];
|
||||
|
||||
/* INITIALIZE VARIABLES BEFORE SEARCHING FOR INTERPOLATED PEAK */
|
||||
im = 0;
|
||||
cor2m = cor2[n];
|
||||
energym = energy[n];
|
||||
eni = energy[n];
|
||||
|
||||
/* DERTERMINE WHICH SIDE THE INTERPOLATED PEAK FALLS IN, THEN
|
||||
DO THE SEARCH IN THE APPROPRIATE RANGE */
|
||||
if (cor2[n + 1]*energy[n - 1] > cor2[n - 1]*energy[n + 1]) /* if right side */
|
||||
{
|
||||
deltae = (energy[n + 1] - eni)*INVDECF; /*increment for linear interp.*/
|
||||
for (k = 0; k < HDECF; k++)
|
||||
{
|
||||
ci = a*bv16_x2[k] + b*bv16_x[k] + c; /* quadratically interpolated cor[] */
|
||||
eni += deltae; /* linearly interpolated energy[] */
|
||||
if (ci*ci*energym > cor2m*eni)
|
||||
{
|
||||
im = k + 1;
|
||||
cor2m = ci*ci;
|
||||
energym = eni;
|
||||
}
|
||||
}
|
||||
}
|
||||
else /* if interpolated peak is on the left side */
|
||||
{
|
||||
deltae=(energy[n-1] - eni) * INVDECF; /*increment for linear interp.*/
|
||||
for (k = 0; k < HDECF; k++)
|
||||
{
|
||||
ci = a*bv16_x2[k] - b*bv16_x[k] + c;
|
||||
eni += deltae;
|
||||
if (ci*ci*energym > cor2m*eni)
|
||||
{
|
||||
im = -k-1;
|
||||
cor2m=ci*ci;
|
||||
energym=eni;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* SEARCH DONE; ASSIGN cor2[] AND energy[] CORRESPONDING TO
|
||||
INTERPOLATED PEAK */
|
||||
plag[i] = (idx[i] + 1)*cpp_scale + im; /* lag of interp. peak */
|
||||
cor2i[i] = cor2m; /* interpolated cor2[] of i-th interpolated peak */
|
||||
energyi[i] = energym; /* interpolated energy[] of i-th interpolated peak */
|
||||
|
||||
/* SEARCH FOR GLOBAL MAXIMUM OF INTERPOLATED cor2[]/energy[] peak */
|
||||
if (cor2m*energymax > cor2max*energym)
|
||||
{
|
||||
imax = i;
|
||||
cor2max = cor2m;
|
||||
energymax = energym;
|
||||
}
|
||||
}
|
||||
cpp = plag[imax]; /* first candidate for coarse pitch period */
|
||||
mplth = plag[npeaks - 1]*1.0/DECF; /* plag[] is Q2 */
|
||||
|
||||
/* FIND THE LARGEST PEAK (IF THERE IS ANY) AROUND THE LAST PITCH */
|
||||
maxdev = (int) (DEVTH*cpplast); /* maximum deviation from last pitch */
|
||||
im = -1;
|
||||
cor2m = -1e30;
|
||||
energym = 1.0F;
|
||||
for (i = 0; i < npeaks; i++) /* loop thru the peaks before the largest peak */
|
||||
{
|
||||
if (abs(plag[i] - cpplast) <= maxdev)
|
||||
{
|
||||
if (cor2i[i]*energym > cor2m*energyi[i])
|
||||
{
|
||||
im = i;
|
||||
cor2m = cor2i[i];
|
||||
energym = energyi[i];
|
||||
}
|
||||
}
|
||||
} /* if there is no peaks around last pitch, then im is still -1 */
|
||||
|
||||
/* NOW SEE IF WE SHOULD PICK ANY ALTERNATICE PEAK */
|
||||
/* FIRST, SEARCH FIRST HALF OF PITCH RANGE, SEE IF ANY QUALIFIED PEAK
|
||||
HAS LARGE ENOUGH PEAKS AT EVERY MULTIPLE OF ITS LAG */
|
||||
i = 0;
|
||||
while (plag[i] < 0.5*mplth*DECF)
|
||||
{
|
||||
/* DETERMINE THE APPROPRIATE THRESHOLD FOR THIS PEAK */
|
||||
if (i != im) /* if not around last pitch, */
|
||||
{
|
||||
threshold = TH1; /* use a higher threshold */
|
||||
}
|
||||
else /* if around last pitch */
|
||||
{
|
||||
threshold = TH2; /* use a lower threshold */
|
||||
}
|
||||
|
||||
/* IF THRESHOLD EXCEEDED, TEST PEAKS AT MULTIPLES OF THIS LAG */
|
||||
if (cor2i[i]*energymax > threshold*cor2max*energyi[i])
|
||||
{
|
||||
flag = 1;
|
||||
j = i + 1;
|
||||
k = 0;
|
||||
s = 2.0F*plag[i]; /* initialize t to twice the current lag */
|
||||
while (s <= mplth*DECF) /* loop thru all multiple lag <= mplth */
|
||||
{
|
||||
mpflag = 0; /* initialize multiple pitch flag to 0 */
|
||||
a = MPR1*s; /* multiple pitch range lower bound */
|
||||
b = MPR2*s; /* multiple pitch range upper bound */
|
||||
while (j < npeaks) /* loop thru peaks with larger lags */
|
||||
{
|
||||
if (plag[j] > b) /* if range exceeded, */
|
||||
{
|
||||
break; /* break the innermost while loop */
|
||||
} /* if didn't break, then plag[j] <= b */
|
||||
if (plag[j] > a) /* if current peak lag within range, */
|
||||
{
|
||||
/* then check if peak value large enough */
|
||||
if (k < 4)
|
||||
{
|
||||
c = bv16_MPTH[k];
|
||||
}
|
||||
else
|
||||
{
|
||||
c = MPTH4;
|
||||
}
|
||||
if (cor2i[j]*energymax > c*cor2max*energyi[j])
|
||||
{
|
||||
mpflag = 1; /* if peak large enough, set mpflag, */
|
||||
break; /* and break the innermost while loop */
|
||||
}
|
||||
}
|
||||
j++;
|
||||
}
|
||||
/* if no qualified peak found at this multiple lag */
|
||||
if (mpflag == 0)
|
||||
{
|
||||
flag = 0; /* disqualify the lag plag[i] */
|
||||
break; /* and break the while (s<=mplth) loop */
|
||||
}
|
||||
k++;
|
||||
s += plag[i]; /* update s to the next multiple pitch lag */
|
||||
}
|
||||
/* if there is a qualified peak at every multiple of plag[i], */
|
||||
if (flag == 1)
|
||||
return plag[i]; /* and return to calling function */
|
||||
}
|
||||
i++;
|
||||
if (i == npeaks)
|
||||
break; /* to avoid out of array bound error */
|
||||
}
|
||||
|
||||
/* IF PROGRAM PROCEEDS TO HERE, NONE OF THE PEAKS WITH LAGS < 0.5*mplth
|
||||
QUALIFIES AS THE FINAL PITCH. IN THIS CASE, CHECK IF
|
||||
THERE IS ANY PEAK LARGE ENOUGH AROUND LAST PITCH. IF SO, USE ITS
|
||||
LAG AS THE FINAL PITCH. */
|
||||
if (im != -1) /* if there is at least one peak around last pitch */
|
||||
{
|
||||
if (im == imax) /* if this peak is also the global maximum, */
|
||||
return cpp; /* return first pitch candidate at global max */
|
||||
if (im < imax) /* if lag of this peak < lag of global max, */
|
||||
{
|
||||
if (cor2m*energymax > LPTH2*cor2max*energym)
|
||||
{
|
||||
if (plag[im] > HMAXPPD*cpp_scale)
|
||||
return plag[im];
|
||||
for (k = 2; k <= 5; k++) /* check if current candidate pitch */
|
||||
{
|
||||
s = plag[imax]/(float)(k); /* is a sub-multiple of */
|
||||
a = SMDTH1*s; /* the time lag of */
|
||||
b = SMDTH2*s; /* the global maximum peak */
|
||||
if (plag[im] > a && plag[im] < b) /* if so, */
|
||||
return plag[im]; /* and return as pitch */
|
||||
}
|
||||
}
|
||||
}
|
||||
else /* if lag of this peak > lag of global max, */
|
||||
{
|
||||
if (cor2m*energymax > LPTH1*cor2max*energym)
|
||||
return plag[im]; /* accept its lag */
|
||||
}
|
||||
}
|
||||
|
||||
/* IF PROGRAM PROCEEDS TO HERE, WE HAVE NO CHOICE BUT TO ACCEPT THE
|
||||
LAG OF THE GLOBAL MAXIMUM */
|
||||
return cpp;
|
||||
}
|
|
@ -1,192 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* decoder.c -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv16decoder.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bv16cnst.h"
|
||||
#include "bv16strct.h"
|
||||
#include "bv16externs.h"
|
||||
#include "bvcommon.h"
|
||||
#include "utility.h"
|
||||
#include "bv16postfilter.h"
|
||||
#include "bitpack16.h"
|
||||
#include "broadvoice/broadvoice.h"
|
||||
|
||||
BV_DECLARE(bv16_decode_state_t *) bv16_decode_init(bv16_decode_state_t *s)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (s == NULL)
|
||||
{
|
||||
if ((s = (bv16_decode_state_t *) malloc(sizeof(*s))) == NULL)
|
||||
return NULL;
|
||||
}
|
||||
for (i = 0; i < LPCO; i++)
|
||||
s->lsplast[i] = (Float)(i + 1)/(Float)(LPCO + 1);
|
||||
Fzero(s->stsym, LPCO);
|
||||
Fzero(s->ltsym, LTMOFF);
|
||||
Fzero(s->xq, XQOFF);
|
||||
Fzero(s->lgpm, LGPORDER);
|
||||
Fzero(s->lsppm, LPCO*LSPPORDER);
|
||||
Fzero(s->prevlg, 2);
|
||||
s->pp_last = 50;
|
||||
s->cfecount = 0;
|
||||
s->idum = 0;
|
||||
s->per = 0;
|
||||
s->E = 0.0;
|
||||
for (i = 0; i < LPCO; i++)
|
||||
s->atplc[i + 1] = 0.0;
|
||||
s->ngfae = LGPORDER + 1;
|
||||
s->lmax = -100.0;
|
||||
s->lmin = 100.0;
|
||||
s->lmean = 12.5;
|
||||
s->x1 = 17.0;
|
||||
s->level = 17.0;
|
||||
s->nggalgc = Nfdm + 1;
|
||||
s->estl_alpha_min = estl_alpha;
|
||||
s->ma_a = 0.0;
|
||||
s->b_prv[0] = 1.0;
|
||||
s->b_prv[1] = 0.0;
|
||||
s->pp_prv = 100;
|
||||
return s;
|
||||
}
|
||||
|
||||
BV_DECLARE(int) bv16_decode(bv16_decode_state_t *ds,
|
||||
int16_t amp[],
|
||||
const uint8_t *in,
|
||||
int len)
|
||||
{
|
||||
Float xq[LXQ]; /* quantized 8 kHz low-band signal */
|
||||
Float ltsym[LTMOFF + FRSZ];
|
||||
Float a[LPCO + 1];
|
||||
Float lspq[LPCO];
|
||||
Float bq[3];
|
||||
Float gainq;
|
||||
Float lgq;
|
||||
Float lg_el;
|
||||
Float xpf[FRSZ];
|
||||
int16_t pp;
|
||||
Float bss;
|
||||
Float E;
|
||||
struct BV16_Bit_Stream bs;
|
||||
int ii;
|
||||
int outlen;
|
||||
|
||||
outlen = 0;
|
||||
for (ii = 0; ii < len; ii += 10)
|
||||
{
|
||||
bv16_bitunpack(&in[ii], &bs);
|
||||
|
||||
/* Set frame erasure flags */
|
||||
if (ds->cfecount != 0)
|
||||
{
|
||||
ds->ngfae = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ds->ngfae++;
|
||||
if (ds->ngfae > LGPORDER)
|
||||
ds->ngfae = LGPORDER + 1;
|
||||
}
|
||||
|
||||
/* Reset frame erasure counter */
|
||||
ds->cfecount = 0;
|
||||
|
||||
/* Decode pitch period */
|
||||
pp = bs.ppidx + MINPP;
|
||||
|
||||
/* Decode spectral information */
|
||||
lspdec(lspq, bs.lspidx, ds->lsppm, ds->lsplast);
|
||||
lsp2a(lspq, a);
|
||||
Fcopy(ds->lsplast, lspq, LPCO);
|
||||
|
||||
/* Decode pitch taps */
|
||||
bv16_pp3dec(bs.bqidx, bq);
|
||||
|
||||
/* Decode gain */
|
||||
gainq = gaindec(&lgq, bs.gidx, ds->lgpm, ds->prevlg, ds->level, &ds->nggalgc, &lg_el);
|
||||
|
||||
/* Copy state memory to buffer */
|
||||
Fcopy(ltsym, ds->ltsym, LTMOFF);
|
||||
Fcopy(xq, ds->xq, XQOFF);
|
||||
|
||||
/* Decode the excitation signal including long-term synthesis and codevector scaling */
|
||||
excdec_w_LT_synth(ltsym, bs.qvidx, gainq, bq, pp, bv16_cccb, &E);
|
||||
|
||||
ds->E = E;
|
||||
|
||||
/* LPC synthesis filtering of short-term excitation */
|
||||
apfilter(a, LPCO, ltsym + LTMOFF, xq + XQOFF, FRSZ, ds->stsym, 1);
|
||||
|
||||
/* Update the remaining state memory */
|
||||
ds->pp_last = pp;
|
||||
Fcopy(ds->xq, xq + FRSZ, XQOFF);
|
||||
Fcopy(ds->ltsym, ltsym + FRSZ, LTMOFF);
|
||||
Fcopy(ds->bq_last, bq, 3);
|
||||
|
||||
/* Level estimation */
|
||||
estlevel(lg_el, &ds->level, &ds->lmax, &ds->lmin, &ds->lmean, &ds->x1, ds->ngfae, ds->nggalgc, &ds->estl_alpha_min);
|
||||
|
||||
/* Adaptive postfiltering */
|
||||
postfilter(xq, pp, &(ds->ma_a), ds->b_prv, &(ds->pp_prv), xpf);
|
||||
F2s(&[outlen], xpf, FRSZ);
|
||||
|
||||
Fcopy(ds->atplc, a, LPCO + 1);
|
||||
|
||||
bss = bq[0] + bq[1] + bq[2];
|
||||
if (bss > 1.0)
|
||||
bss = 1.0;
|
||||
else if (bss < 0.0)
|
||||
bss = 0.0;
|
||||
ds->per = 0.5*ds->per + 0.5*bss;
|
||||
outlen += FRSZ;
|
||||
}
|
||||
return outlen;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
BV_DECLARE(int) bv16_decode_release(bv16_decode_state_t *s)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
BV_DECLARE(int) bv16_decode_free(bv16_decode_state_t *s)
|
||||
{
|
||||
free(s);
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
/*- End of file ------------------------------------------------------------*/
|
|
@ -1,230 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* encoder.c -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bv16cnst.h"
|
||||
#include "utility.h"
|
||||
#include "bv16externs.h"
|
||||
#include "bv16strct.h"
|
||||
#include "bvcommon.h"
|
||||
#include "bitpack16.h"
|
||||
#include "broadvoice/broadvoice.h"
|
||||
|
||||
BV_DECLARE(bv16_encode_state_t *) bv16_encode_init(bv16_encode_state_t *s)
|
||||
{
|
||||
int k;
|
||||
|
||||
if (s == NULL)
|
||||
{
|
||||
if ((s = (bv16_encode_state_t *) malloc(sizeof(*s))) == NULL)
|
||||
return NULL;
|
||||
}
|
||||
Fzero(s->lgpm, LGPORDER);
|
||||
s->old_A[0] = 1.0;
|
||||
Fzero(s->old_A + 1, LPCO);
|
||||
for (k = 0; k < LPCO; k++)
|
||||
s->lsplast[k] = (Float) (k + 1)/(Float)(LPCO + 1);
|
||||
Fzero(s->lsppm, LPCO*LSPPORDER);
|
||||
Fzero(s->x, XOFF);
|
||||
Fzero(s->xwd, XDOFF);
|
||||
Fzero(s->dq, XOFF);
|
||||
Fzero(s->stpem, LPCO);
|
||||
Fzero(s->stwpm, LPCO);
|
||||
Fzero(s->dfm, DFO);
|
||||
Fzero(s->stsym, LPCO);
|
||||
Fzero(s->stnfz, NSTORDER);
|
||||
Fzero(s->stnfp, NSTORDER);
|
||||
Fzero(s->ltsym, MAXPP1 + FRSZ);
|
||||
Fzero(s->ltnfm, MAXPP1 + FRSZ);
|
||||
Fzero(s->hpfzm, HPO);
|
||||
Fzero(s->hpfpm, HPO);
|
||||
Fzero(s->prevlg, 2);
|
||||
s->cpplast = 12*cpp_scale;
|
||||
s->lmax = -100.0;
|
||||
s->lmin = 100.0;
|
||||
s->lmean = 12.5;
|
||||
s->x1 = 17.0;
|
||||
s->level = 17.0;
|
||||
return s;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
BV_DECLARE(int) bv16_encode(bv16_encode_state_t *cs,
|
||||
uint8_t *out,
|
||||
const int16_t amp[],
|
||||
int len)
|
||||
{
|
||||
Float x[LX]; /* Signal buffer */
|
||||
Float dq[LX]; /* Quantized int16_t term pred error, low-band */
|
||||
Float xw[FRSZ]; /* Perceptually weighted low-band signal */
|
||||
Float r[NSTORDER + 1];
|
||||
Float a[LPCO + 1];
|
||||
Float aw[LPCO + 1];
|
||||
Float fsz[1 + NSTORDER];
|
||||
Float fsp[1 + NSTORDER];
|
||||
Float lsp[LPCO];
|
||||
Float lspq[LPCO];
|
||||
Float cbs[VDIM*CBSZ];
|
||||
Float bq[3];
|
||||
Float beta;
|
||||
Float gainq;
|
||||
Float lg;
|
||||
Float ppt;
|
||||
Float dummy;
|
||||
int pp;
|
||||
int cpp;
|
||||
int i;
|
||||
struct BV16_Bit_Stream bs;
|
||||
int ii;
|
||||
int outlen;
|
||||
|
||||
outlen = 0;
|
||||
for (ii = 0; ii < len; ii += FRSZ)
|
||||
{
|
||||
/* Copy state memory to local memory buffers */
|
||||
Fcopy(x, cs->x, XOFF);
|
||||
for (i = 0; i < FRSZ; i++)
|
||||
x[XOFF + i] = (Float) amp[ii + i];
|
||||
|
||||
/* 150Hz high pass filtering */
|
||||
azfilter(bv16_hpfb, HPO, x + XOFF, x + XOFF, FRSZ, cs->hpfzm, 1);
|
||||
apfilter(bv16_hpfa, HPO, x + XOFF, x + XOFF, FRSZ, cs->hpfpm, 1);
|
||||
|
||||
/* Update highpass filtered signal buffer */
|
||||
Fcopy(cs->x, x + FRSZ, XOFF);
|
||||
|
||||
/* Perform lpc analysis with asymmetrical window */
|
||||
Autocor(r, x + LX - WINSZ, bv16_winl, WINSZ, NSTORDER); /* get autocorrelation lags */
|
||||
for (i = 0; i <= NSTORDER; i++)
|
||||
r[i] *= bv16_sstwin[i]; /* apply spectral smoothing */
|
||||
Levinson(r, a, cs->old_A, LPCO); /* Levinson-Durbin recursion */
|
||||
|
||||
/* Pole-zero noise feedback filter */
|
||||
for (i = 0; i <= NSTORDER; i++)
|
||||
{
|
||||
fsz[i] = a[i]*bv16_gfsz[i];
|
||||
fsp[i] = a[i]*bv16_gfsp[i];
|
||||
}
|
||||
|
||||
/* Bandwidth expansion */
|
||||
for (i = 0; i <= LPCO; i++)
|
||||
a[i] *= bwel[i];
|
||||
|
||||
/* LPC -> LSP Conversion */
|
||||
a2lsp(a, lsp, cs->lsplast);
|
||||
|
||||
/* Spectral Quantization */
|
||||
lspquan(lspq, bs.lspidx, lsp, cs->lsppm);
|
||||
|
||||
lsp2a(lspq, a);
|
||||
|
||||
/* Calculate lpc prediction residual */
|
||||
Fcopy(dq, cs->dq, XOFF); /* copy dq() state to buffer */
|
||||
azfilter(a, LPCO, x + XOFF, dq + XOFF, FRSZ, cs->stpem, 1);
|
||||
|
||||
/* Weighted version of lpc filter to generate weighted speech */
|
||||
for (i = 0; i <= LPCO; i++)
|
||||
aw[i] = STWAL[i]*a[i];
|
||||
|
||||
/* Get perceptually weighted speech signal */
|
||||
apfilter(aw, LPCO, dq + XOFF, xw, FRSZ, cs->stwpm, 1);
|
||||
|
||||
/* Get the coarse version of pitch period using 4:1 decimation */
|
||||
cpp = coarsepitch(xw, cs->xwd, cs->dfm, cs->cpplast);
|
||||
cs->cpplast = cpp;
|
||||
|
||||
/* Refine the pitch period in the neighborhood of coarse pitch period
|
||||
also calculate the pitch predictor tap for single-tap predictor */
|
||||
pp = refinepitch(dq, cpp, &ppt);
|
||||
bs.ppidx = (int16_t) (pp - MINPP);
|
||||
|
||||
/* Vector quantize 3 pitch predictor taps with minimum residual energy */
|
||||
bs.bqidx = (int16_t) pitchtapquan(dq, pp, bq, &lg);
|
||||
|
||||
/* Get coefficients of long-term noise feedback filter */
|
||||
if (ppt > 1.0)
|
||||
beta = LTWFL;
|
||||
else if (ppt < 0.0)
|
||||
beta = 0.0;
|
||||
else
|
||||
beta = LTWFL*ppt;
|
||||
|
||||
/* Gain quantization */
|
||||
lg = (lg < FRSZ) ? 0 : log(lg/FRSZ)/log(2.0);
|
||||
bs.gidx = (int16_t) gainquan(&gainq, lg, cs->lgpm, cs->prevlg, cs->level);
|
||||
|
||||
/* Level estimation */
|
||||
dummy = estl_alpha;
|
||||
estlevel(cs->prevlg[0],
|
||||
&cs->level,
|
||||
&cs->lmax,
|
||||
&cs->lmin,
|
||||
&cs->lmean,
|
||||
&cs->x1,
|
||||
LGPORDER + 1,
|
||||
Nfdm + 1,
|
||||
&dummy);
|
||||
|
||||
/* Scale the scalar quantizer codebook */
|
||||
for (i = 0; i < (VDIM*CBSZ); i++)
|
||||
cbs[i] = gainq*bv16_cccb[i];
|
||||
|
||||
/* Perform noise feedback coding of the excitation signal */
|
||||
excquan(bs.qvidx, x + XOFF, a, fsz, fsp, bq, beta, cs->stsym,
|
||||
cs->ltsym, cs->ltnfm, cs->stnfz, cs->stnfp, cbs, pp);
|
||||
|
||||
/* Update state memory */
|
||||
Fcopy(dq + XOFF, cs->ltsym + MAXPP1, FRSZ);
|
||||
Fcopy(cs->dq, dq + FRSZ, XOFF);
|
||||
i = bv16_bitpack(out, &bs);
|
||||
out += i;
|
||||
outlen += i;
|
||||
}
|
||||
return outlen;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
BV_DECLARE(int) bv16_encode_release(bv16_encode_state_t *s)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
BV_DECLARE(int) bv16_encode_free(bv16_encode_state_t *s)
|
||||
{
|
||||
free(s);
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
/*- End of file ------------------------------------------------------------*/
|
|
@ -1,86 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* bv16excdec.c - Excitation signal decoding including long-term synthesis.
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv16excdec.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bv16cnst.h"
|
||||
#include "bv16externs.h"
|
||||
|
||||
void excdec_w_LT_synth(Float *ltsym, /* Long-term synthesis filter memory at decoder */
|
||||
int16_t *idx, /* Excitation codebook index array for current subframe */
|
||||
Float gainq, /* Quantized linear gains for sub-subframes */
|
||||
Float *b, /* Coefficient of 3-tap pitch predictor */
|
||||
int16_t pp, /* Pitch period */
|
||||
const Float *cb, /* Scalar quantizer codebook */
|
||||
Float *EE)
|
||||
{
|
||||
Float a0;
|
||||
Float *fp1;
|
||||
Float *fp2;
|
||||
const Float *fp3;
|
||||
Float gain;
|
||||
int m;
|
||||
int n;
|
||||
int id;
|
||||
int16_t *ip;
|
||||
Float E;
|
||||
Float t;
|
||||
|
||||
ip = idx;
|
||||
fp1 = <sym[LTMOFF]; /* fp1 points to 1st sample of current subframe */
|
||||
fp2 = <sym[LTMOFF - pp + 1];
|
||||
E = 0.0;
|
||||
for (m = 0; m < FRSZ; m += VDIM) /* loop thru vectors in sub-subframe */
|
||||
{
|
||||
id = *ip++; /* get codebook index of current vector */
|
||||
if (id < CBSZ)
|
||||
{
|
||||
gain = gainq;
|
||||
}
|
||||
else
|
||||
{
|
||||
gain = -gainq;
|
||||
id -= CBSZ;
|
||||
}
|
||||
fp3 = &cb[id*VDIM];
|
||||
for (n = 0; n < VDIM; n++)
|
||||
{
|
||||
a0 = b[0] * *fp2--;
|
||||
a0 += b[1] * *fp2--;
|
||||
a0 += b[2] * *fp2;/* a0=pitch predicted value of LT syn filt */
|
||||
t = *fp3++ * gain;
|
||||
E += t*t;
|
||||
*fp1++ = a0 + t; /* add scale codevector to a0 */
|
||||
fp2 = &fp2[3]; /* prepare fp2 for filtering next sample */
|
||||
}
|
||||
}
|
||||
*EE = E;
|
||||
}
|
|
@ -1,312 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* bv16excquan.c : Vector Quantizer for 2-Stage Noise Feedback Coding
|
||||
* with long-term predictive noise feedback coding embedded
|
||||
* inside the int16_t-term predictive noise feedback coding loop.
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include "typedef.h"
|
||||
#include "bv16cnst.h"
|
||||
#include "bvcommon.h"
|
||||
#include "bv16externs.h"
|
||||
|
||||
void excquan(int16_t *idx, /* quantizer codebook index for uq[] vector */
|
||||
Float *s, /* input speech signal vector */
|
||||
Float *aq, /* int16_t-term predictor coefficient array */
|
||||
Float *fsz, /* int16_t-term noise feedback filter - numerator */
|
||||
Float *fsp, /* int16_t-term noise feedback filter - denominator */
|
||||
Float *b, /* coefficient of 3-tap pitch predictor */
|
||||
Float beta, /* coefficient of 1-tap LT noise feedback filter */
|
||||
Float *stsym, /* int16_t-term synthesis filter memory */
|
||||
Float *ltsym, /* long-term synthesis filter memory */
|
||||
Float *ltnfm, /* long-term noise feedback filter memory */
|
||||
Float *stnfz,
|
||||
Float *stnfp,
|
||||
Float *cb, /* scalar quantizer codebook */
|
||||
int pp) /* pitch period */
|
||||
{
|
||||
Float qzir[VDIM]; /* Zero-input response */
|
||||
Float qzsr[VDIM*CBSZ]; /* Negated zero-state response of codebook */
|
||||
Float uq[VDIM]; /* Selected codebook vector (incl. sign) */
|
||||
Float buf1[LPCO + FRSZ]; /* Buffer for filter memory & signal */
|
||||
Float buf2[NSTORDER + FRSZ]; /* Buffer for filter memory */
|
||||
Float buf3[NSTORDER + FRSZ]; /* Buffer for filter memory */
|
||||
Float buf4[VDIM]; /* Buffer for filter memory */
|
||||
Float a0;
|
||||
Float a1;
|
||||
Float a2;
|
||||
Float *fp1;
|
||||
Float *fp2;
|
||||
Float *fp3;
|
||||
Float *fp4;
|
||||
Float sign;
|
||||
Float *fpa;
|
||||
Float *fpb;
|
||||
Float ltfv[VDIM];
|
||||
Float ppv[VDIM];
|
||||
int i;
|
||||
int j;
|
||||
int m;
|
||||
int n;
|
||||
int jmin;
|
||||
int iv;
|
||||
Float buf5[VDIM]; /* Buffer for filter memory */
|
||||
Float buf6[VDIM]; /* Buffer for filter memory */
|
||||
Float e;
|
||||
Float E;
|
||||
Float Emin;
|
||||
Float *p_ppv;
|
||||
Float *p_ltfv;
|
||||
Float *p_uq;
|
||||
Float v;
|
||||
|
||||
/* copy filter memory to beginning part of temporary buffer */
|
||||
fp1 = &stsym[LPCO - 1];
|
||||
for (i = 0; i < LPCO; i++)
|
||||
buf1[i] = *fp1--; /* this buffer is used to avoid memory shifts */
|
||||
|
||||
/* copy noise feedback filter memory */
|
||||
fp1 = &stnfz[NSTORDER - 1];
|
||||
fp2 = &stnfp[NSTORDER - 1];
|
||||
for (i = 0; i < NSTORDER; i++)
|
||||
{
|
||||
buf2[i] = *fp1--;
|
||||
buf3[i] = *fp2--;
|
||||
}
|
||||
|
||||
/************************************************************************************/
|
||||
/* Z e r o - S t a t e R e s p o n s e */
|
||||
/************************************************************************************/
|
||||
/* Calculate negated Zero State Response */
|
||||
fp2 = cb; /* fp2 points to start of first codevector */
|
||||
fp3 = qzsr; /* fp3 points to start of first zero-state response vector */
|
||||
|
||||
/* For each codevector */
|
||||
for (j = 0; j < CBSZ; j++)
|
||||
{
|
||||
/* Calculate the elements of the negated ZSR */
|
||||
for (i = 0; i < VDIM; i++)
|
||||
{
|
||||
/* int16_t-term prediction */
|
||||
a0 = 0.0;
|
||||
fp1 = buf4;
|
||||
for (n = i; n > 0; n--)
|
||||
a0 -= *fp1++ * aq[n];
|
||||
|
||||
/* Update memory of int16_t-term prediction filter */
|
||||
*fp1++ = a0 + *fp2;
|
||||
|
||||
/* noise feedback filter */
|
||||
a1 = 0.0;
|
||||
fpa = buf5;
|
||||
fpb = buf6;
|
||||
for (n = i; n > 0; n--)
|
||||
a1 += ((*fpa++ * fsz[n]) - (*fpb++ * fsp[n]));
|
||||
|
||||
/* Update memory of pole section of noise feedback filter */
|
||||
*fpb++ = a1;
|
||||
|
||||
/* ZSR */
|
||||
*fp3 = *fp2++ + a0 + a1;
|
||||
|
||||
/* Update memory of zero section of noise feedback filter */
|
||||
*fpa++ = -(*fp3++);
|
||||
}
|
||||
}
|
||||
|
||||
/* loop through every vector of the current subframe */
|
||||
iv = 0; /* iv = index of the current vector */
|
||||
for (m = 0; m < FRSZ; m += VDIM)
|
||||
{
|
||||
/********************************************************************************/
|
||||
/* Z e r o - I n p u t R e s p o n s e */
|
||||
/********************************************************************************/
|
||||
/* compute pitch-predicted vector, which should be independent of the
|
||||
residual vq codevectors being tried if vdim < min. pitch period */
|
||||
fp2 = ltfv;
|
||||
fp3 = ppv;
|
||||
for (n = m; n < m + VDIM; n++)
|
||||
{
|
||||
fp1 = <sym[MAXPP1 + n - pp + 1];
|
||||
a1 = b[0] * *fp1--;
|
||||
a1 += b[1] * *fp1--;
|
||||
a1 += b[2] * *fp1--;/* a1=pitch predicted vector of LT syn filt */
|
||||
*fp3++ = a1; /* write result to ppv[] vector */
|
||||
|
||||
*fp2++ = a1 + beta*ltnfm[MAXPP1 + n - pp];
|
||||
}
|
||||
|
||||
/* compute zero-input response */
|
||||
fp2 = ppv;
|
||||
fp4 = ltfv;
|
||||
fp3 = qzir;
|
||||
for (n = m; n < m + VDIM; n++)
|
||||
{
|
||||
/* perform multiply-adds along the delay line of the predictor */
|
||||
fp1 = &buf1[n];
|
||||
a0 = 0.;
|
||||
for (i = LPCO; i > 0; i--)
|
||||
a0 -= *fp1++ * aq[i];
|
||||
|
||||
/* perform multiply-adds along the noise feedback filter */
|
||||
fpa = &buf2[n];
|
||||
fpb = &buf3[n];
|
||||
a1 = 0.;
|
||||
for (i = NSTORDER; i > 0; i--)
|
||||
a1 += ((*fpa++ * fsz[i]) - (*fpb++ * fsp[i]));
|
||||
*fpb = a1; /* update output of the noise feedback filter */
|
||||
|
||||
a2 = s[n] - (a0 + a1); /* v[n] */
|
||||
|
||||
/* a2 now contains v[n]; subtract the sum of the two long-term
|
||||
filters to get the zero-input response */
|
||||
*fp3++ = a2 - *fp4++; /* q[n] = u[n] during ZIR computation */
|
||||
|
||||
/* update int16_t-term noise feedback filter memory */
|
||||
a0 += *fp2; /* a0 now conatins the qs[n] */
|
||||
*fp1 = a0;
|
||||
a2 -= *fp2++; /* a2 now contains qszi[n] */
|
||||
*fpa = a2; /* update int16_t-term noise feedback filter memory */
|
||||
}
|
||||
|
||||
/********************************************************************************/
|
||||
/* S e a r c h C o d e b o o k */
|
||||
/********************************************************************************/
|
||||
/* loop through every codevector of the residual vq codebook */
|
||||
/* and find the one that minimizes the energy of q[n] */
|
||||
Emin = 1e30;
|
||||
fp4 = qzsr;
|
||||
sign = 0.0F;
|
||||
jmin = 0;
|
||||
for (j = 0; j < CBSZ; j++)
|
||||
{
|
||||
/* Try positive sign */
|
||||
fp2 = qzir;
|
||||
E = 0.0;
|
||||
for (n = 0; n < VDIM; n++)
|
||||
{
|
||||
e = *fp2++ - *fp4++; // sign impacted by negated ZSR
|
||||
E += e*e;
|
||||
}
|
||||
if (E < Emin)
|
||||
{
|
||||
jmin = j;
|
||||
Emin = E;
|
||||
sign = +1.0F;
|
||||
}
|
||||
/* Try negative sign */
|
||||
fp4 -= VDIM;
|
||||
fp2 = qzir;
|
||||
E = 0.0;
|
||||
for (n = 0; n < VDIM; n++)
|
||||
{
|
||||
e = *fp2++ + *fp4++; // sign impacted by negated ZSR
|
||||
E += e*e;
|
||||
}
|
||||
if (E < Emin)
|
||||
{
|
||||
jmin = j;
|
||||
Emin = E;
|
||||
sign = -1.0F;
|
||||
}
|
||||
}
|
||||
|
||||
/* The best codevector has been found; assign vq codebook index */
|
||||
if (sign == 1.0F)
|
||||
idx[iv++] = (int16_t) jmin;
|
||||
else
|
||||
idx[iv++] = (int16_t) (jmin + CBSZ); /* MSB of index is sign bit */
|
||||
|
||||
fp3 = &cb[jmin*VDIM]; /* fp3 points to start of best codevector */
|
||||
for (n = 0; n < VDIM; n++)
|
||||
uq[n] = sign * *fp3++;
|
||||
/********************************************************************************/
|
||||
|
||||
|
||||
/********************************************************************************/
|
||||
/* U p d a t e F i l t e r M e m o r y */
|
||||
/********************************************************************************/
|
||||
fp3 = ltsym + MAXPP1 + m;
|
||||
fp4 = ltnfm + MAXPP1 + m;
|
||||
p_ltfv = ltfv;
|
||||
p_ppv = ppv;
|
||||
p_uq = uq;
|
||||
for (n = m; n < m + VDIM; n++)
|
||||
{
|
||||
/* Update memory of long-term synthesis filter */
|
||||
*fp3 = *p_ppv++ + *p_uq;
|
||||
|
||||
/* int16_t-term prediction */
|
||||
a0 = 0.0;
|
||||
fp1 = &buf1[n];
|
||||
for (i = LPCO; i > 0; i--)
|
||||
a0 -= *fp1++ * aq[i];
|
||||
|
||||
/* Update memory of int16_t-term synthesis filter */
|
||||
*fp1++ = a0 + *fp3;
|
||||
|
||||
/* int16_t-term pole-zero noise feedback filter */
|
||||
fpa = &buf2[n];
|
||||
fpb = &buf3[n];
|
||||
a1 = 0.0;
|
||||
for (i = NSTORDER; i > 0; i--)
|
||||
a1 += ((*fpa++ * fsz[i]) - (*fpb++ * fsp[i]));
|
||||
|
||||
/* Update memory of pole section of noise feedback filter */
|
||||
*fpb++ = a1;
|
||||
|
||||
v = s[n] - a0 - a1;
|
||||
|
||||
/* Update memory of zero section of noise feedback filter */
|
||||
*fpa++ = v - *fp3++;
|
||||
|
||||
/* Update memory of long-term noise feedback filter */
|
||||
*fp4++ = v - *p_ltfv++ - *p_uq++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Update short-term predictor and noise feedback filter memories after subframe */
|
||||
for (i = 0; i < LPCO; i++)
|
||||
stsym[i] = *--fp1;
|
||||
|
||||
for (i = 0; i < NSTORDER; i++)
|
||||
{
|
||||
stnfz[i] = *--fpa;
|
||||
stnfp[i] = *--fpb;
|
||||
}
|
||||
|
||||
/* update long-term predictor and noise feedback filter memories after subframe */
|
||||
fp2 = <nfm[FRSZ];
|
||||
fp3 = <sym[FRSZ];
|
||||
for (i = 0; i < MAXPP1; i++)
|
||||
{
|
||||
ltnfm[i] = fp2[i];
|
||||
ltsym[i] = fp3[i];
|
||||
}
|
||||
}
|
|
@ -1,165 +0,0 @@
|
|||
/*****************************************************************************/
|
||||
/* BroadVoice(R)16 (BV16) Floating-Point ANSI-C Source Code */
|
||||
/* Revision Date: August 19, 2009 */
|
||||
/* Version 1.0 */
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Copyright 2000-2009 Broadcom Corporation */
|
||||
/* */
|
||||
/* This software is provided under the GNU Lesser General Public License, */
|
||||
/* version 2.1, as published by the Free Software Foundation ("LGPL"). */
|
||||
/* This program is distributed in the hope that it will be useful, but */
|
||||
/* WITHOUT ANY SUPPORT OR WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the LGPL for */
|
||||
/* more details. A copy of the LGPL is available at */
|
||||
/* http://www.broadcom.com/licenses/LGPLv2.1.php, */
|
||||
/* or by writing to the Free Software Foundation, Inc., */
|
||||
/* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
bv16externs.c : BV16 Fixed-Point externs
|
||||
|
||||
$Log: bv16externs.h,v $
|
||||
Revision 1.1.1.1 2009/11/19 12:10:48 steveu
|
||||
Start from Broadcom's code
|
||||
|
||||
Revision 1.1.1.1 2009/11/17 14:06:02 steveu
|
||||
start
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bv16cnst.h"
|
||||
#include "bvcommon.h"
|
||||
|
||||
/* POINTERS */
|
||||
extern const Float bv16_winl[WINSZ];
|
||||
extern const Float bv16_sstwin[1 + LPCO];
|
||||
extern const Float bv16_gfsz[];
|
||||
extern const Float bv16_gfsp[];
|
||||
extern const int bv16_idxord[];
|
||||
extern const Float bv16_hpfa[];
|
||||
extern const Float bv16_hpfb[];
|
||||
extern const Float bv16_adf[];
|
||||
extern const Float bv16_bdf[];
|
||||
extern const Float bv16_x[];
|
||||
extern const Float bv16_x2[];
|
||||
extern const Float bv16_MPTH[];
|
||||
|
||||
/* LSP Quantization */
|
||||
extern const Float bv16_lspecb1[LSPECBSZ1*LPCO];
|
||||
extern const Float bv16_lspecb2[LSPECBSZ2*LPCO];
|
||||
extern const Float bv16_lspmean[LPCO];
|
||||
extern const Float bv16_lspp[LSPPORDER*LPCO];
|
||||
|
||||
/* Pitch Predictor Codebook */
|
||||
extern const Float bv16_pp9cb[PPCBSZ*9];
|
||||
|
||||
/* Log-Gain Quantization */
|
||||
extern const Float bv16_lgpecb[LGPECBSZ];
|
||||
extern const Float bv16_lgp[LGPORDER];
|
||||
extern const Float bv16_lgmean;
|
||||
|
||||
/* Log-Gain Limitation */
|
||||
extern const Float bv16_lgclimit[];
|
||||
|
||||
/* Excitation Codebook */
|
||||
extern const Float bv16_cccb[CBSZ*VDIM];
|
||||
|
||||
extern const Float bv16_lgpecb_nh[];
|
||||
|
||||
/* Function Prototypes */
|
||||
extern Float estlevel(Float lg,
|
||||
Float *level,
|
||||
Float *lmax,
|
||||
Float *lmin,
|
||||
Float *lmean,
|
||||
Float *x1,
|
||||
int16_t ngfae,
|
||||
int16_t nggalgc,
|
||||
Float *estl_alpha_min);
|
||||
|
||||
extern void excdec_w_LT_synth(
|
||||
Float *ltsym, /* long-term synthesis filter memory at decoder*/
|
||||
int16_t *idx, /* excitation codebook index array for current subframe */
|
||||
Float gainq, /* quantized linear gains for sub-subframes */
|
||||
Float *b, /* coefficient of 3-tap pitch predictor */
|
||||
int16_t pp, /* pitch period */
|
||||
const Float *cb, /* scalar quantizer codebook */
|
||||
Float *EE);
|
||||
|
||||
extern Float gaindec(Float *lgq,
|
||||
int16_t gidx,
|
||||
Float *lgpm,
|
||||
Float *prevlg, /* previous log gains (last two frames) */
|
||||
Float level,
|
||||
int16_t *nggalgc,
|
||||
Float *lg_el);
|
||||
|
||||
extern Float gaindec_fe(Float lgq_last,
|
||||
Float *lgpm);
|
||||
|
||||
void gainplc(Float E,
|
||||
Float *lgeqm,
|
||||
Float *lgqm);
|
||||
|
||||
extern void lspdec(
|
||||
Float *lspq,
|
||||
int16_t *lspidx,
|
||||
Float *lsppm,
|
||||
Float *lspq_last);
|
||||
|
||||
extern void lspplc(
|
||||
Float *lspq,
|
||||
Float *lsppm);
|
||||
|
||||
extern int coarsepitch(
|
||||
Float *xw,
|
||||
Float *xwd,
|
||||
Float *dfm,
|
||||
int cpplast);
|
||||
|
||||
extern int refinepitch(
|
||||
Float *x,
|
||||
int cpp,
|
||||
Float *ppt);
|
||||
|
||||
extern int pitchtapquan(
|
||||
Float *x,
|
||||
int pp,
|
||||
Float *b,
|
||||
Float *re);
|
||||
|
||||
extern void excquan(
|
||||
int16_t *idx, /* quantizer codebook index for uq[] vector */
|
||||
Float *s, /* input speech signal vector */
|
||||
Float *aq, /* short-term predictor coefficient array */
|
||||
Float *fsz, /* short-term noise feedback filter - numerator */
|
||||
Float *fsp, /* short-term noise feedback filter - denominator */
|
||||
Float *b, /* coefficient of 3-tap pitch predictor */
|
||||
Float beta, /* coefficient of 1-tap LT noise feedback filter */
|
||||
Float *stsym, /* filter memory before filtering of current vector */
|
||||
Float *ltsym, /* long-term synthesis filter memory */
|
||||
Float *ltnfm, /* long-term noise feedback filter memory */
|
||||
Float *stnfz,
|
||||
Float *stnfp,
|
||||
Float *cb, /* scalar quantizer codebook */
|
||||
int pp); /* pitch period (# of 8 kHz samples) */
|
||||
|
||||
extern int gainquan(
|
||||
Float *gainq,
|
||||
Float lg,
|
||||
Float *lgpm,
|
||||
Float *prevlg,
|
||||
Float level);
|
||||
|
||||
extern void lspquan(
|
||||
Float *lspq,
|
||||
int16_t *lspidx,
|
||||
Float *lsp,
|
||||
Float *lsppm);
|
||||
|
||||
extern void bv16_pp3dec(int16_t idx, Float *b);
|
|
@ -1,102 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* bv16fine_pitch.c - Fine pitch search
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv16fine_pitch.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bv16cnst.h"
|
||||
#include "bv16externs.h"
|
||||
|
||||
#define FS (XOFF+1) /* Frame Starting index */
|
||||
#define FE (XOFF+FRSZ) /* Frame Ending index */
|
||||
#define DEV (DECF-1)
|
||||
|
||||
int refinepitch(Float *x,
|
||||
int cpp,
|
||||
Float *ppt)
|
||||
{
|
||||
Float cor, cor2, energy, cormax, cor2max, energymax;
|
||||
Float *fp0, *fp1, *fp2, *fp3;
|
||||
int lb, ub, pp, i, j;
|
||||
|
||||
if (cpp >= MAXPP)
|
||||
cpp = MAXPP - 1;
|
||||
if (cpp < MINPP)
|
||||
cpp = MINPP;
|
||||
lb = cpp - DEV;
|
||||
if (lb < MINPP)
|
||||
lb = MINPP; /* lower bound of pitch period search range */
|
||||
ub = cpp + DEV;
|
||||
/* to avoid selecting MAXPP as the refined pitch period */
|
||||
if (ub >= MAXPP)
|
||||
ub = MAXPP - 1;/* lower bound of pitch period search range */
|
||||
|
||||
i = lb; /* start the search from lower bound */
|
||||
|
||||
fp0 = x + FS - 1;
|
||||
fp1 = x + FS - 1 - i;
|
||||
cor = energy = 0.0;
|
||||
for (j = 0; j < (FE - FS + 1); j++)
|
||||
{
|
||||
energy += (*fp1) * (*fp1);
|
||||
cor += (*fp0++) * (*fp1++);
|
||||
}
|
||||
|
||||
pp = i;
|
||||
cormax = cor;
|
||||
cor2max = cor*cor;
|
||||
energymax = energy;
|
||||
|
||||
fp0 = x + FE - lb - 1;
|
||||
fp1 = x + FS - lb - 2;
|
||||
for (i = lb + 1; i <= ub; i++)
|
||||
{
|
||||
fp2 = x + FS - 1;
|
||||
fp3 = x + FS - i - 1;
|
||||
cor = 0.;
|
||||
for (j = 0; j < (FE - FS + 1); j++)
|
||||
cor += (*fp2++)*(*fp3++);
|
||||
cor2 = cor*cor;
|
||||
energy += ((*fp1)*(*fp1) - (*fp0)*(*fp0));
|
||||
fp0--;
|
||||
fp1--;
|
||||
if ((cor2*energymax) > (cor2max*energy))
|
||||
{
|
||||
pp = i;
|
||||
cormax = cor;
|
||||
cor2max = cor2;
|
||||
energymax = energy;
|
||||
}
|
||||
}
|
||||
|
||||
*ppt = (energymax != 0) ? (cormax/energymax) : 0.0;
|
||||
|
||||
return pp;
|
||||
}
|
|
@ -1,175 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* bv16gaindec.c - Gain decoding
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv16gaindec.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include "typedef.h"
|
||||
#include "bv16strct.h"
|
||||
#include "bv16externs.h"
|
||||
|
||||
Float gaindec(Float *lgq,
|
||||
int16_t gidx,
|
||||
Float *lgpm,
|
||||
Float *prevlg, /* previous log gains (last two frames) */
|
||||
Float level,
|
||||
int16_t *nggalgc,
|
||||
Float *lg_el)
|
||||
{
|
||||
Float gainq;
|
||||
Float elg;
|
||||
Float lgc;
|
||||
Float lgq_nh;
|
||||
int i;
|
||||
int n;
|
||||
int k;
|
||||
|
||||
/* calculate estimated log-gain */
|
||||
elg = 0;
|
||||
for (i = 0; i < LGPORDER; i++)
|
||||
elg += bv16_lgp[i]*lgpm[i];
|
||||
|
||||
elg += bv16_lgmean;
|
||||
|
||||
/* Calculate decoded log-gain */
|
||||
*lgq = bv16_lgpecb[gidx] + elg;
|
||||
|
||||
/* next higher gain */
|
||||
if (gidx < LGPECBSZ - 1)
|
||||
{
|
||||
lgq_nh = bv16_lgpecb_nh[gidx] + elg;
|
||||
if (*lgq < 0.0 && fabs(lgq_nh) < fabs(*lgq))
|
||||
{
|
||||
/* To avoid thresholding when the enc Q makes it below the threshold */
|
||||
*lgq = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
/* look up from lgclimit() table the maximum log gain change allowed */
|
||||
i = (int) ((prevlg[0] - level - LGLB) * 0.5F); /* get column index */
|
||||
if (i >= NGB)
|
||||
i = NGB - 1;
|
||||
else if (i < 0)
|
||||
i = 0;
|
||||
n = (int) ((prevlg[0] - prevlg[1] - LGCLB) * 0.5F); /* get row index */
|
||||
if (n >= NGCB)
|
||||
n = NGCB - 1;
|
||||
else if (n < 0)
|
||||
n = 0;
|
||||
|
||||
i = i*NGCB + n;
|
||||
|
||||
/* update log-gain predictor memory,
|
||||
check whether decoded log-gain exceeds lgclimit */
|
||||
for (k = LGPORDER - 1; k > 0; k--)
|
||||
lgpm[k] = lgpm[k - 1];
|
||||
|
||||
lgc = *lgq - prevlg[0];
|
||||
if ((lgc > bv16_lgclimit[i]) && (gidx > 0)) /* if decoded log-gain exceeds limit */
|
||||
{
|
||||
*lgq = prevlg[0]; /* use the log-gain of previous frame */
|
||||
lgpm[0] = *lgq - elg;
|
||||
*nggalgc = 0;
|
||||
*lg_el = bv16_lgclimit[i] + prevlg[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
lgpm[0] = bv16_lgpecb[gidx];
|
||||
*nggalgc = *nggalgc + 1;
|
||||
if (*nggalgc > Nfdm)
|
||||
*nggalgc = Nfdm + 1;
|
||||
*lg_el = *lgq;
|
||||
}
|
||||
|
||||
/* update log-gain predictor memory */
|
||||
prevlg[1] = prevlg[0];
|
||||
prevlg[0] = *lgq;
|
||||
|
||||
/* convert quantized log-gain to linear domain */
|
||||
gainq = pow(2.0F, 0.5F * *lgq);
|
||||
|
||||
return gainq;
|
||||
}
|
||||
|
||||
Float gaindec_fe(Float lgq_last,
|
||||
Float *lgpm)
|
||||
{
|
||||
Float elg;
|
||||
int i;
|
||||
|
||||
/* calculate estimated log-gain */
|
||||
elg = 0.0F;
|
||||
for (i = 0; i < LGPORDER; i++)
|
||||
elg += bv16_lgp[i]*lgpm[i];
|
||||
|
||||
/* update log-gain predictor memory */
|
||||
for (i = LGPORDER - 1; i > 0; i--)
|
||||
lgpm[i] = lgpm[ i- 1];
|
||||
lgpm[0] = lgq_last - bv16_lgmean - elg;
|
||||
|
||||
return lgq_last;
|
||||
}
|
||||
|
||||
void gainplc(Float E,
|
||||
Float *lgeqm,
|
||||
Float *lgqm)
|
||||
{
|
||||
int k;
|
||||
Float pe;
|
||||
Float lg;
|
||||
Float mrlg;
|
||||
Float elg;
|
||||
Float lge;
|
||||
|
||||
pe = INVFRSZ*E;
|
||||
|
||||
if (pe - TMinlg > 0.0)
|
||||
lg = log(pe)/log(2.0);
|
||||
else
|
||||
lg = Minlg;
|
||||
|
||||
mrlg = lg - bv16_lgmean;
|
||||
|
||||
elg = 0.0;
|
||||
for (k = 0; k < GPO; k++)
|
||||
elg += bv16_lgp[k]*lgeqm[k];
|
||||
|
||||
/* Predicted log-gain error */
|
||||
lge = mrlg - elg;
|
||||
|
||||
/* Update quantizer memory */
|
||||
for (k = GPO - 1; k > 0; k--)
|
||||
lgeqm[k] = lgeqm[k - 1];
|
||||
lgeqm[0] = lge;
|
||||
|
||||
/* Update quantized log-gain memory */
|
||||
lgqm[1] = lgqm[0];
|
||||
lgqm[0] = lg;
|
||||
}
|
|
@ -1,124 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* bv16gainquan.c - Gain quantization based on inter-subframe
|
||||
* moving-average prediction of logarithmic gain.
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv16gainquan.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include "typedef.h"
|
||||
#include "bv16externs.h"
|
||||
|
||||
int gainquan(Float *gainq,
|
||||
Float lg,
|
||||
Float *lgpm,
|
||||
Float *prevlg, /* previous log gains (last two frames) */
|
||||
Float level)
|
||||
{
|
||||
Float elg;
|
||||
Float lgpe;
|
||||
Float limit;
|
||||
Float dmin;
|
||||
Float d;
|
||||
int i;
|
||||
int n;
|
||||
int gidx = 0;
|
||||
const int *p_gidx;
|
||||
|
||||
/* Calculate estimated log-gain */
|
||||
elg = bv16_lgmean;
|
||||
for (i = 0; i < LGPORDER; i++)
|
||||
elg += bv16_lgp[i]*lgpm[i];
|
||||
|
||||
/* subtract log-gain mean & estimated log-gain to get prediction error */
|
||||
lgpe = lg - elg;
|
||||
|
||||
/* scalar quantization of log-gain prediction error */
|
||||
dmin = 1e30;
|
||||
p_gidx = bv16_idxord;
|
||||
for (i = 0; i < LGPECBSZ; i++)
|
||||
{
|
||||
d = lgpe - bv16_lgpecb[*p_gidx++];
|
||||
if (d < 0.0F)
|
||||
d = -d;
|
||||
if (d < dmin)
|
||||
{
|
||||
dmin = d;
|
||||
gidx = i;
|
||||
}
|
||||
}
|
||||
|
||||
/* calculate quantized log-gain */
|
||||
*gainq = bv16_lgpecb[bv16_idxord[gidx]] + elg;
|
||||
|
||||
/* look up from lgclimit() table the maximum log gain change allowed */
|
||||
i = (int) ((prevlg[0] - level - LGLB)*0.5F); /* get column index */
|
||||
if (i >= NGB)
|
||||
{
|
||||
i = NGB - 1;
|
||||
}
|
||||
else if (i < 0)
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
n = (int) ((prevlg[0] - prevlg[1] - LGCLB) * 0.5F); /* get row index */
|
||||
if (n >= NGCB)
|
||||
{
|
||||
n = NGCB - 1;
|
||||
}
|
||||
else if (n < 0)
|
||||
{
|
||||
n = 0;
|
||||
}
|
||||
i = i * NGCB + n;
|
||||
|
||||
/* check whether quantized log-gain cause a gain change > lgclimit */
|
||||
limit = prevlg[0] + bv16_lgclimit[i];/* limit that log-gain shouldn't exceed */
|
||||
while ((*gainq > limit) && (gidx > 0)) /* if q log-gain exceeds limit */
|
||||
{
|
||||
gidx -= 1; /* decrement gain quantizer index by 1 */
|
||||
*gainq = bv16_lgpecb[bv16_idxord[gidx]] + elg; /* use next quantizer output*/
|
||||
}
|
||||
|
||||
/* Get true codebook index */
|
||||
gidx = bv16_idxord[gidx];
|
||||
|
||||
/* update log-gain predictor memory */
|
||||
prevlg[1] = prevlg[0];
|
||||
prevlg[0] = *gainq;
|
||||
for (i = LGPORDER - 1; i > 0; i--)
|
||||
lgpm[i] = lgpm[i - 1];
|
||||
lgpm[0] = bv16_lgpecb[gidx];
|
||||
|
||||
/* convert quantized log-gain to linear domain */
|
||||
*gainq = pow(2.0F, 0.5F * *gainq);
|
||||
|
||||
return gidx;
|
||||
}
|
||||
|
|
@ -1,99 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* bv16levelest.c - Signal level estimation
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv16levelest.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bv16externs.h"
|
||||
|
||||
Float estlevel(
|
||||
Float lg,
|
||||
Float *level,
|
||||
Float *lmax,
|
||||
Float *lmin,
|
||||
Float *lmean,
|
||||
Float *x1,
|
||||
int16_t ngfae,
|
||||
int16_t nggalgc,
|
||||
Float *estl_alpha_min)
|
||||
{
|
||||
Float lth;
|
||||
|
||||
/* Reset forgetting factor for Lmin to fast decay. This is to avoid Lmin staying at an
|
||||
incorrect low level compensating for the possibility it has caused incorrect bit-error
|
||||
declaration by making the estimated level too low. */
|
||||
if (nggalgc == 0)
|
||||
{
|
||||
*estl_alpha_min = estl_alpha1;
|
||||
}
|
||||
/* Reset forgetting factor for Lmin to regular decay if fast decay has taken place for
|
||||
the past Nfdm frames. */
|
||||
else if (nggalgc == Nfdm+1)
|
||||
{
|
||||
*estl_alpha_min = estl_alpha;
|
||||
}
|
||||
|
||||
/* update the new maximum, minimum, & mean of log-gain */
|
||||
if (lg > *lmax)
|
||||
{
|
||||
*lmax=lg; /* use new log-gain as max if it is > max */
|
||||
}
|
||||
else
|
||||
{
|
||||
*lmax=*lmean+estl_alpha*(*lmax-*lmean); /* o.w. attenuate toward lmean */
|
||||
}
|
||||
|
||||
if (lg < *lmin && ngfae == LGPORDER+1 && nggalgc > LGPORDER
|
||||
)
|
||||
{
|
||||
*lmin=lg; /* use new log-gain as min if it is < min */
|
||||
/* Reset forgetting factor for Lmin to regular decay in case it has been on
|
||||
fast decay since it has now found a new minimum level. */
|
||||
*estl_alpha_min = estl_alpha;
|
||||
}
|
||||
else
|
||||
{
|
||||
*lmin=*lmean+(*estl_alpha_min)*(*lmin-*lmean); /* o.w. attenuate toward lmean */
|
||||
}
|
||||
|
||||
*lmean=estl_beta*(*lmean)+estl_beta1*(0.5*(*lmax+*lmin));
|
||||
|
||||
/* update estimated input level, by calculating a running average
|
||||
(using an exponential window) of log-gains exceeding lmean */
|
||||
lth=*lmean+estl_TH*(*lmax-*lmean);
|
||||
if (lg > lth)
|
||||
{
|
||||
*x1=estl_a*(*x1)+estl_a1*lg;
|
||||
*level=estl_a*(*level)+estl_a1*(*x1);
|
||||
}
|
||||
|
||||
return lth;
|
||||
|
||||
}
|
|
@ -1,175 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* bv16lspdec.c - LSP decoding
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv16lspdec.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include "typedef.h"
|
||||
#include "bv16externs.h"
|
||||
#include "bvcommon.h"
|
||||
|
||||
void vqdec(Float *, int16_t, const Float *, int, int);
|
||||
|
||||
void lspdec(Float *lspq,
|
||||
int16_t *lspidx,
|
||||
Float *lsppm,
|
||||
Float *lspq_last)
|
||||
{
|
||||
Float elsp[LPCO];
|
||||
Float lspe[LPCO];
|
||||
Float lspeq1[LPCO];
|
||||
Float lspeq2[LPCO];
|
||||
Float a0;
|
||||
Float *fp1;
|
||||
Float *fp2;
|
||||
const Float *fp3;
|
||||
int i;
|
||||
int k;
|
||||
int sign;
|
||||
int stbl;
|
||||
|
||||
/* calculate estimated (ma-predicted) lsp vector */
|
||||
fp3 = bv16_lspp;
|
||||
fp2 = lsppm;
|
||||
for (i = 0; i < LPCO; i++)
|
||||
{
|
||||
a0 = 0.0F;
|
||||
for (k = 0; k < LSPPORDER; k++)
|
||||
a0 += *fp3++ * *fp2++;
|
||||
elsp[i] = a0;
|
||||
}
|
||||
|
||||
/* perform first-stage vq codebook decode */
|
||||
vqdec(lspeq1, lspidx[0], bv16_lspecb1, LPCO, LSPECBSZ1);
|
||||
|
||||
/* perform second-stage vq codebook decode */
|
||||
if (lspidx[1] >= LSPECBSZ2)
|
||||
{
|
||||
sign = -1;
|
||||
lspidx[1] = (2*LSPECBSZ2 - 1) - lspidx[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
sign = 1;
|
||||
}
|
||||
vqdec(lspeq2, lspidx[1], bv16_lspecb2, LPCO, LSPECBSZ2);
|
||||
|
||||
/* get overall quantizer output vector of the two-stage vq */
|
||||
for (i = 0; i < LPCO; i++)
|
||||
lspe[i] = lspeq1[i] + sign*lspeq2[i];
|
||||
|
||||
/* calculate quantized lsp for stability check */
|
||||
for (i = 0; i < STBLDIM; i++)
|
||||
lspq[i] = lspe[i] + elsp[i] + bv16_lspmean[i];
|
||||
|
||||
/* detect bit-errors based on ordering property of LSP */
|
||||
stbl = stblchck(lspq, STBLDIM);
|
||||
|
||||
/* replace LSP if bit-errors are detected */
|
||||
if (!stbl)
|
||||
{
|
||||
for (i = 0; i < LPCO; i++)
|
||||
{
|
||||
lspq[i] = lspq_last[i];
|
||||
lspe[i] = lspq[i] - elsp[i] - bv16_lspmean[i];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* calculate remaining quantized LSP for error free case */
|
||||
for (i = STBLDIM; i < LPCO; i++)
|
||||
lspq[i] = lspe[i] + elsp[i] + bv16_lspmean[i];
|
||||
}
|
||||
|
||||
/* update lsp ma predictor memory */
|
||||
i = LPCO * LSPPORDER - 1;
|
||||
fp1 = &lsppm[i];
|
||||
fp2 = &lsppm[i - 1];
|
||||
for (i = LPCO - 1; i >= 0; i--)
|
||||
{
|
||||
for (k = LSPPORDER; k > 1; k--)
|
||||
*fp1-- = *fp2--;
|
||||
*fp1-- = lspe[i];
|
||||
fp2--;
|
||||
}
|
||||
|
||||
/* ensure correct ordering of lsp to guarantee lpc filter stability */
|
||||
stblz_lsp(lspq, LPCO);
|
||||
}
|
||||
|
||||
|
||||
void vqdec(Float *xq, /* VQ output vector (quantized version of input vector) */
|
||||
int16_t idx, /* VQ codebook index for the nearest neighbor */
|
||||
const Float *cb, /* VQ codebook */
|
||||
int vdim, /* vector dimension */
|
||||
int cbsz) /* codebook size (number of codevectors) */
|
||||
{
|
||||
int j;
|
||||
int k;
|
||||
|
||||
j = idx * vdim;
|
||||
for (k = 0; k < vdim; k++)
|
||||
xq[k] = cb[j + k];
|
||||
}
|
||||
|
||||
|
||||
void lspplc(Float *lspq, Float *lsppm)
|
||||
{
|
||||
Float elsp[LPCO];
|
||||
Float a0;
|
||||
Float *fp1;
|
||||
const Float *fp2;
|
||||
const Float *fp3;
|
||||
int i;
|
||||
int k;
|
||||
|
||||
/* Calculate estimated (ma-predicted) lsp vector */
|
||||
fp3 = bv16_lspp;
|
||||
fp2 = lsppm;
|
||||
for (i = 0; i < LPCO; i++)
|
||||
{
|
||||
a0 = 0.0F;
|
||||
for (k = 0; k < LSPPORDER; k++)
|
||||
a0 += *fp3++ * *fp2++;
|
||||
elsp[i] = a0;
|
||||
}
|
||||
|
||||
/* Update lsp ma predictor memory */
|
||||
i = LPCO*LSPPORDER - 1;
|
||||
fp1 = &lsppm[i];
|
||||
fp2 = &lsppm[i - 1];
|
||||
for (i = LPCO - 1; i >= 0; i--)
|
||||
{
|
||||
for (k = LSPPORDER; k > 1; k--)
|
||||
*fp1-- = *fp2--;
|
||||
*fp1-- = lspq[i] - bv16_lspmean[i] - elsp[i];
|
||||
fp2--;
|
||||
}
|
||||
}
|
|
@ -1,264 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* bv16lspquan.c - LSP quantization based on inter-frame moving-average
|
||||
* prediction and two-stage VQ.
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include "typedef.h"
|
||||
#include "bv16externs.h"
|
||||
#include "bvcommon.h"
|
||||
|
||||
void vqmse(Float *xq,
|
||||
int16_t *idx,
|
||||
Float *x,
|
||||
const Float *cb,
|
||||
int vdim,
|
||||
int cbsz);
|
||||
|
||||
void svqwmse(Float *xq,
|
||||
int16_t *idx,
|
||||
Float *x,
|
||||
Float *xa,
|
||||
Float *w,
|
||||
const Float *cb,
|
||||
int vdim,
|
||||
int cbsz);
|
||||
|
||||
void lspquan(Float *lspq,
|
||||
int16_t *lspidx,
|
||||
Float *lsp,
|
||||
Float *lsppm)
|
||||
{
|
||||
Float d[LPCO];
|
||||
Float w[LPCO];
|
||||
Float elsp[LPCO];
|
||||
Float lspe[LPCO];
|
||||
Float lspa[LPCO];
|
||||
Float lspeq1[LPCO];
|
||||
Float lspeq2[LPCO];
|
||||
Float a0;
|
||||
Float *fp1;
|
||||
const Float *fp2;
|
||||
const Float *fp3;
|
||||
int i;
|
||||
int k;
|
||||
|
||||
/* Calculate the weights for weighted mean-square error distortion */
|
||||
for (i = 0; i < LPCO - 1; i++)
|
||||
d[i] = lsp[i + 1] - lsp[i]; /* LSP difference vector */
|
||||
w[0] = 1.0F/d[0];
|
||||
for (i = 1; i < LPCO - 1; i++)
|
||||
{
|
||||
if (d[i] < d[i-1])
|
||||
w[i] = 1.0F/d[i];
|
||||
else
|
||||
w[i] = 1.0F/d[i - 1];
|
||||
}
|
||||
w[LPCO - 1] = 1.0F/d[LPCO - 2];
|
||||
|
||||
/* Calculate estimated (ma-predicted) lsp vector */
|
||||
fp3 = bv16_lspp;
|
||||
fp2 = lsppm;
|
||||
for (i = 0; i < LPCO; i++)
|
||||
{
|
||||
a0 = 0.0F;
|
||||
for (k = 0; k < LSPPORDER; k++)
|
||||
a0 += *fp3++ * *fp2++;
|
||||
elsp[i] = a0;
|
||||
}
|
||||
|
||||
/* Subtract lsp mean value & estimated lsp to get prediction error */
|
||||
for (i = 0; i < LPCO; i++)
|
||||
lspe[i] = lsp[i] - bv16_lspmean[i] - elsp[i];
|
||||
|
||||
/* Perform first-stage mse vq codebook search */
|
||||
vqmse(lspeq1, &lspidx[0], lspe, bv16_lspecb1, LPCO, LSPECBSZ1);
|
||||
|
||||
/* Calculate quantization error vector of first-stage vq */
|
||||
for (i = 0; i < LPCO; i++)
|
||||
d[i] = lspe[i] - lspeq1[i];
|
||||
|
||||
/* Perform second-stage vq codebook search, signed codebook with wmse */
|
||||
for (i = 0; i < LPCO; i++)
|
||||
lspa[i] = bv16_lspmean[i] + elsp[i] + lspeq1[i];
|
||||
svqwmse(lspeq2, &lspidx[1], d, lspa, w, bv16_lspecb2, LPCO, LSPECBSZ2);
|
||||
|
||||
/* Get overall quantizer output vector of the two-stage vq */
|
||||
for (i = 0; i < LPCO; i++)
|
||||
lspe[i] = lspeq1[i] + lspeq2[i];
|
||||
|
||||
/* Update lsp ma predictor memory */
|
||||
i = LPCO * LSPPORDER - 1;
|
||||
fp1 = &lsppm[i];
|
||||
fp2 = &lsppm[i - 1];
|
||||
for (i = LPCO - 1; i >= 0; i--)
|
||||
{
|
||||
for (k = LSPPORDER; k > 1; k--)
|
||||
*fp1-- = *fp2--;
|
||||
*fp1-- = lspe[i];
|
||||
fp2--;
|
||||
}
|
||||
|
||||
/* Calculate quantized lsp */
|
||||
for (i = 0; i < LPCO; i++)
|
||||
lspq[i] = lspa[i] + lspeq2[i];
|
||||
|
||||
/* Ensure correct ordering of lsp to guarantee lpc filter stability */
|
||||
stblz_lsp(lspq, LPCO);
|
||||
}
|
||||
|
||||
void vqmse(Float *xq, /* VQ output vector (quantized version of input vector) */
|
||||
int16_t *idx, /* VQ codebook index for the nearest neighbor */
|
||||
Float *x, /* input vector */
|
||||
const Float *cb, /* VQ codebook */
|
||||
int vdim, /* vector dimension */
|
||||
int cbsz) /* codebook size (number of codevectors) */
|
||||
{
|
||||
const Float *fp1;
|
||||
Float dmin;
|
||||
Float d;
|
||||
int j;
|
||||
int k;
|
||||
Float e;
|
||||
|
||||
fp1 = cb;
|
||||
dmin = 1.0e30;
|
||||
for (j = 0; j < cbsz; j++)
|
||||
{
|
||||
d = 0.0F;
|
||||
for (k = 0; k < vdim; k++)
|
||||
{
|
||||
e = x[k] - (*fp1++);
|
||||
d += e*e;
|
||||
}
|
||||
if (d < dmin)
|
||||
{
|
||||
dmin = d;
|
||||
*idx = (int16_t) j;
|
||||
}
|
||||
}
|
||||
|
||||
j = *idx * vdim;
|
||||
for (k = 0; k < vdim; k++)
|
||||
xq[k] = cb[j + k];
|
||||
}
|
||||
|
||||
/* Signed WMSE VQ */
|
||||
void svqwmse(Float *xq, /* VQ output vector (quantized version of input vector) */
|
||||
int16_t *idx, /* VQ codebook index for the nearest neighbor */
|
||||
Float *x, /* input vector */
|
||||
Float *xa, /* approximation prior to current stage */
|
||||
Float *w, /* weights for weighted Mean-Square Error */
|
||||
const Float *cb, /* VQ codebook */
|
||||
int vdim, /* vector dimension */
|
||||
int cbsz) /* codebook size (number of codevectors) */
|
||||
{
|
||||
const Float *fp1;
|
||||
const Float *fp2;
|
||||
Float dmin;
|
||||
Float d;
|
||||
Float xqc[STBLDIM];
|
||||
int j;
|
||||
int k;
|
||||
int stbl;
|
||||
int sign = 1;
|
||||
Float e;
|
||||
|
||||
fp1 = cb;
|
||||
dmin = 1e30;
|
||||
*idx = -1;
|
||||
|
||||
for (j = 0; j < cbsz; j++)
|
||||
{
|
||||
/* Try negative sign */
|
||||
d = 0.0;
|
||||
fp2 = fp1;
|
||||
|
||||
for (k = 0; k < vdim; k++)
|
||||
{
|
||||
e = x[k] + *fp1++;
|
||||
d += w[k]*e*e;
|
||||
}
|
||||
|
||||
/* Check candidate - negative sign */
|
||||
if (d < dmin)
|
||||
{
|
||||
for (k = 0; k < STBLDIM; k++)
|
||||
xqc[k] = xa[k] - *fp2++;
|
||||
/* Check stability - negative sign */
|
||||
stbl = stblchck(xqc, STBLDIM);
|
||||
if (stbl > 0)
|
||||
{
|
||||
dmin = d;
|
||||
*idx = (int16_t) j;
|
||||
sign = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Try positive sign */
|
||||
fp1 -= vdim;
|
||||
d = 0.0;
|
||||
fp2 = fp1;
|
||||
|
||||
for (k = 0; k < vdim; k++)
|
||||
{
|
||||
e = x[k] - *fp1++;
|
||||
d += w[k]*e*e;
|
||||
}
|
||||
|
||||
/* Check candidate - positive sign */
|
||||
if (d < dmin)
|
||||
{
|
||||
for (k = 0; k < STBLDIM; k++)
|
||||
xqc[k] = xa[k] + *fp2++;
|
||||
|
||||
/* Check stability - positive sign */
|
||||
stbl = stblchck(xqc, STBLDIM);
|
||||
if (stbl > 0)
|
||||
{
|
||||
dmin = d;
|
||||
*idx = (int16_t) j;
|
||||
sign = +1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (*idx == -1)
|
||||
{
|
||||
printf("\nWARNING: Encoder-decoder synchronization lost for clean channel!!!\n");
|
||||
*idx = 0;
|
||||
sign = 1;
|
||||
}
|
||||
|
||||
fp1 = cb + (*idx)*vdim;
|
||||
for (k = 0; k < vdim; k++)
|
||||
xq[k] = (double) sign*(*fp1++);
|
||||
if (sign < 0)
|
||||
*idx = (2*cbsz - 1) - (*idx);
|
||||
}
|
|
@ -1,148 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* bv16plc.c - Packet loss concealment
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv16plc.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include "typedef.h"
|
||||
#include "bv16cnst.h"
|
||||
#include "bv16strct.h"
|
||||
#include "bv16externs.h"
|
||||
#include "bvcommon.h"
|
||||
|
||||
#include "utility.h"
|
||||
#include "bv16postfilter.h"
|
||||
#include "broadvoice/broadvoice.h"
|
||||
|
||||
BV_DECLARE(int) bv16_fillin(bv16_decode_state_t *ds, int16_t amp[], int len)
|
||||
{
|
||||
int n;
|
||||
Float r[FRSZ]; /* random excitation */
|
||||
Float E;
|
||||
Float gain;
|
||||
Float scplcg;
|
||||
Float xq[LXQ];
|
||||
Float s[FRSZ]; /* enhanced short-term excitation */
|
||||
Float d[LTMOFF + FRSZ]; /* long-term synthesis filter memory */
|
||||
Float *sq;
|
||||
|
||||
/************************************************************/
|
||||
/* Copy decoder state memory */
|
||||
/************************************************************/
|
||||
Fcopy(d, ds->ltsym, LTMOFF); /* excitation */
|
||||
Fcopy(xq, ds->xq, XQOFF);
|
||||
|
||||
sq = xq + XQOFF;
|
||||
/************************************************************/
|
||||
/* Update counter of consecutive list frames */
|
||||
/************************************************************/
|
||||
if (ds->cfecount < HoldPLCG + AttnPLCG - 1)
|
||||
ds->cfecount++;
|
||||
ds->ngfae = 0;
|
||||
|
||||
/************************************************************/
|
||||
/* Generate Unscaled Excitation */
|
||||
/************************************************************/
|
||||
E = 0.0;
|
||||
for (n = 0; n < FRSZ; n++)
|
||||
{
|
||||
ds->idum = 1664525L*ds->idum + 1013904223L;
|
||||
r[n] = (Float)(ds->idum >> 16) - 32767.0;
|
||||
E += r[n]*r[n];
|
||||
}
|
||||
|
||||
/************************************************************/
|
||||
/* Calculate Scaling */
|
||||
/************************************************************/
|
||||
scplcg = ScPLCG_a + ScPLCG_b*ds->per;
|
||||
if (scplcg > ScPLCGmax)
|
||||
scplcg = ScPLCGmax;
|
||||
else if (scplcg < ScPLCGmin)
|
||||
scplcg = ScPLCGmin;
|
||||
gain = scplcg * sqrt(ds->E/E);
|
||||
|
||||
/************************************************************/
|
||||
/* Long-term synthesis filter */
|
||||
/************************************************************/
|
||||
for (n = 0; n < FRSZ; n++)
|
||||
{
|
||||
d[LTMOFF+n] = gain*r[n];
|
||||
d[LTMOFF+n] += ds->bq_last[0]*d[LTMOFF + n-ds->pp_last + 1];
|
||||
d[LTMOFF+n] += ds->bq_last[1]*d[LTMOFF + n-ds->pp_last];
|
||||
d[LTMOFF+n] += ds->bq_last[2]*d[LTMOFF + n-ds->pp_last - 1];
|
||||
}
|
||||
|
||||
/************************************************************/
|
||||
/* Short-term synthesis filter */
|
||||
/************************************************************/
|
||||
apfilter(ds->atplc, LPCO, d+LTMOFF, sq, FRSZ, ds->stsym, 1);
|
||||
|
||||
/************************************************************/
|
||||
/* Save decoder state memory */
|
||||
/************************************************************/
|
||||
Fcopy(ds->ltsym, d+FRSZ, LTMOFF); /* excitation */
|
||||
|
||||
/************************************************************/
|
||||
/* Update memory of predictive LSP quantizer */
|
||||
/************************************************************/
|
||||
lspplc(ds->lsplast, ds->lsppm);
|
||||
|
||||
/************************************************************/
|
||||
/* Update memory of predictive gain quantizer */
|
||||
/************************************************************/
|
||||
gainplc(ds->E, ds->lgpm, ds->prevlg);
|
||||
|
||||
/************************************************************/
|
||||
/* Signal level estimation */
|
||||
/************************************************************/
|
||||
estlevel(ds->prevlg[0], &ds->level, &ds->lmax, &ds->lmin, &ds->lmean,
|
||||
&ds->x1, ds->ngfae, ds->nggalgc, &ds->estl_alpha_min);
|
||||
|
||||
/************************************************************/
|
||||
/* Attenuation during long packet losses */
|
||||
/************************************************************/
|
||||
if (ds->cfecount >= HoldPLCG)
|
||||
{
|
||||
gain = 1.0 - AttnFacPLCG*(Float)(ds->cfecount - (HoldPLCG - 1));
|
||||
ds->bq_last[0] = gain*ds->bq_last[0];
|
||||
ds->bq_last[1] = gain*ds->bq_last[1];
|
||||
ds->bq_last[2] = gain*ds->bq_last[2];
|
||||
ds->E = (gain*gain)*ds->E;
|
||||
}
|
||||
|
||||
/************************************************************/
|
||||
/* Adaptive Postfiltering */
|
||||
/************************************************************/
|
||||
postfilter(xq, ds->pp_last, &(ds->ma_a), ds->b_prv, &(ds->pp_prv), s);
|
||||
F2s(amp, s, FRSZ);
|
||||
Fcopy(ds->xq, xq + FRSZ, XQOFF);
|
||||
|
||||
return FRSZ;
|
||||
}
|
|
@ -1,168 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* postfilt.c - Pitch postfilter
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv16postfilter.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include "typedef.h"
|
||||
#include "bv16strct.h"
|
||||
#include "bv16postfilter.h"
|
||||
|
||||
/* Standard Long-Term Postfilter */
|
||||
|
||||
void postfilter(Float *s, /* input : quantized speech signal */
|
||||
int pp, /* input : pitch period */
|
||||
Float *ma_a,
|
||||
Float *b_prv,
|
||||
int *pp_prv,
|
||||
Float *e) /* output: enhanced speech signal */
|
||||
{
|
||||
int n;
|
||||
Float gain;
|
||||
Float w1;
|
||||
Float w2;
|
||||
int ppt;
|
||||
int pptmin;
|
||||
int pptmax;
|
||||
int ppnew;
|
||||
Float Rx0x1Sq;
|
||||
Float Rx0Rx1;
|
||||
Float Rx0x1Sqmax;
|
||||
Float Rx0Rx1max;
|
||||
Float Rx0x1max;
|
||||
Float bi0;
|
||||
Float bi1c;
|
||||
Float bi1p;
|
||||
Float Rx0x1;
|
||||
Float Rx0;
|
||||
Float Rx1;
|
||||
Float Rxf;
|
||||
Float a;
|
||||
Float b[2];
|
||||
|
||||
/********************************************************************/
|
||||
/* pitch search around decoded pitch */
|
||||
/********************************************************************/
|
||||
pptmin = pp - DPPQNS;
|
||||
pptmax = pp + DPPQNS;
|
||||
if (pptmin < MINPP)
|
||||
{
|
||||
pptmin = MINPP;
|
||||
pptmax = pptmin + 2 * DPPQNS;
|
||||
}
|
||||
else if (pptmax > MAXPP)
|
||||
{
|
||||
pptmax = MAXPP;
|
||||
pptmin = pptmax - 2 * DPPQNS;
|
||||
}
|
||||
Rx0 = 0.0;
|
||||
Rx1 = 0.0;
|
||||
Rx0x1 = 0.0;
|
||||
for (n = 0; n < FRSZ; n++)
|
||||
{
|
||||
Rx0 += s[XQOFF + n]*s[XQOFF + n];
|
||||
Rx1 += s[XQOFF + n - pptmin]*s[XQOFF + n - pptmin];
|
||||
Rx0x1 += s[XQOFF + n]*s[XQOFF + n - pptmin];
|
||||
}
|
||||
ppnew = pptmin;
|
||||
Rx0Rx1max = Rx0*Rx1;
|
||||
Rx0x1max = Rx0x1;
|
||||
Rx0x1Sqmax = Rx0x1*Rx0x1;
|
||||
for (ppt = pptmin + 1; ppt <= pptmax; ppt++)
|
||||
{
|
||||
Rx1 -= s[XQOFF + FRSZ - ppt]*s[XQOFF + FRSZ - ppt];
|
||||
Rx1 += s[XQOFF - ppt]*s[XQOFF - ppt];
|
||||
Rx0Rx1 = Rx0*Rx1;
|
||||
Rx0x1 = 0.0;
|
||||
for (n = 0; n < FRSZ; n++)
|
||||
Rx0x1 += s[XQOFF + n]*s[XQOFF + n - ppt];
|
||||
Rx0x1Sq = Rx0x1 * Rx0x1;
|
||||
if (Rx0x1Sq*Rx0Rx1max > Rx0x1Sqmax*Rx0Rx1)
|
||||
{
|
||||
ppnew = ppt;
|
||||
Rx0x1Sqmax = Rx0x1Sq;
|
||||
Rx0x1max = Rx0x1;
|
||||
Rx0Rx1max = Rx0Rx1;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************/
|
||||
/* calculate all-zero pitch postfilter */
|
||||
/******************************************************************/
|
||||
if (Rx0Rx1max == 0.0 || Rx0x1max <= 0.0)
|
||||
a = 0.0;
|
||||
else
|
||||
a = Rx0x1max/sqrt(Rx0Rx1max);
|
||||
*ma_a = 0.75*(*ma_a) + 0.25*a;
|
||||
if (*ma_a < ATHLD1 && a < ATHLD2)
|
||||
a = 0.0;
|
||||
b[1] = ScLTPF*a;
|
||||
|
||||
/******************************************************************/
|
||||
/* calculate normalization energies */
|
||||
/******************************************************************/
|
||||
Rxf = 0.0;
|
||||
for (n = 0; n < FRSZ; n++)
|
||||
{
|
||||
e[n] = s[XQOFF + n] + b[1]*s[XQOFF + n - ppnew];
|
||||
Rxf += e[n]*e[n];
|
||||
}
|
||||
if (Rx0 == 0.0 || Rxf == 0.0)
|
||||
gain = 1.0;
|
||||
else
|
||||
gain = sqrt(Rx0/Rxf);
|
||||
|
||||
/******************************************************************/
|
||||
/* interpolate from the previous postfilter to the current */
|
||||
/******************************************************************/
|
||||
b[0] = gain;
|
||||
b[1] = gain*b[1];
|
||||
for (n = 0; n < NINT; n++)
|
||||
{
|
||||
w1 = ((Float) (n + 1))/((Float) (NINT + 1));
|
||||
w2 = 1.0 - w1;
|
||||
|
||||
/* interpolate between two filters */
|
||||
bi0 = w1*b[0] + w2*b_prv[0];
|
||||
bi1c = w1*b[1];
|
||||
bi1p = w2*b_prv[1];
|
||||
e[n] = bi1c*s[XQOFF + n - ppnew] + bi1p*s[XQOFF + n - (*pp_prv)] + bi0*s[XQOFF + n];
|
||||
|
||||
}
|
||||
for (n = NINT; n < FRSZ; n++)
|
||||
e[n] = gain*e[n];
|
||||
|
||||
/******************************************************************/
|
||||
/* save state memory */
|
||||
/******************************************************************/
|
||||
b_prv[0] = b[0];
|
||||
b_prv[1] = b[1];
|
||||
*pp_prv = ppnew;
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
/*****************************************************************************/
|
||||
/* BroadVoice(R)16 (BV16) Floating-Point ANSI-C Source Code */
|
||||
/* Revision Date: August 19, 2009 */
|
||||
/* Version 1.0 */
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Copyright 2000-2009 Broadcom Corporation */
|
||||
/* */
|
||||
/* This software is provided under the GNU Lesser General Public License, */
|
||||
/* version 2.1, as published by the Free Software Foundation ("LGPL"). */
|
||||
/* This program is distributed in the hope that it will be useful, but */
|
||||
/* WITHOUT ANY SUPPORT OR WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the LGPL for */
|
||||
/* more details. A copy of the LGPL is available at */
|
||||
/* http://www.broadcom.com/licenses/LGPLv2.1.php, */
|
||||
/* or by writing to the Free Software Foundation, Inc., */
|
||||
/* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
postfilt.h : BV16 Post Filter
|
||||
|
||||
$Log: bv16postfilter.h,v $
|
||||
Revision 1.1.1.1 2009/11/19 12:10:48 steveu
|
||||
Start from Broadcom's code
|
||||
|
||||
Revision 1.1.1.1 2009/11/17 14:06:02 steveu
|
||||
start
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
void postfilter(Float *s, /* input : quantized speech signal */
|
||||
int pp, /* input : pitch period */
|
||||
Float *ma_a,
|
||||
Float *b_prv,
|
||||
int *pp_prv,
|
||||
Float *e); /* output: enhanced speech signal */
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* bv16ptdec.c -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv16ptdec.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bv16externs.h"
|
||||
|
||||
void bv16_pp3dec(int16_t idx, Float *b)
|
||||
{
|
||||
const Float *fp;
|
||||
int i;
|
||||
|
||||
fp = bv16_pp9cb + idx*9;
|
||||
for (i = 0; i < 3; i++)
|
||||
b[i] = fp[i]*0.5;
|
||||
}
|
|
@ -1,125 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* ptquan.c - Pitch quantizer
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv16ptquan.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bv16cnst.h"
|
||||
#include "bv16externs.h"
|
||||
|
||||
int pitchtapquan(
|
||||
Float *x,
|
||||
int pp,
|
||||
Float *b,
|
||||
Float *re)
|
||||
{
|
||||
Float p[9], t, s0, s1, s2, cormax, cor;
|
||||
Float t0, t1, t2;
|
||||
Float *xt;
|
||||
Float *fp0;
|
||||
Float *fp1;
|
||||
const Float *fp2;
|
||||
int ppm2, qidx=0, i, j;
|
||||
|
||||
ppm2 = pp - 2;
|
||||
xt = x + XOFF;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
fp0 = xt;
|
||||
fp1 = x + XOFF - ppm2 - i - 1;
|
||||
t = 0;
|
||||
for (j = 0; j < FRSZ; j++)
|
||||
t += (*fp0++) * (*fp1++);
|
||||
p[i] = t;
|
||||
}
|
||||
|
||||
fp0 = x+XOFF-ppm2-3;
|
||||
s0 = *fp0++;
|
||||
s1 = *fp0++;
|
||||
s2 = *fp0--;
|
||||
t0 = p[8] = s0*s0;
|
||||
t1 = p[4] = s0*s1;
|
||||
p[5] = s0*s2;
|
||||
s0 = *fp0++;
|
||||
s1 = *fp0++;
|
||||
s2 = *fp0--;
|
||||
t2 = s0*s0;
|
||||
p[8] += t2;
|
||||
p[4] += s0*s1;
|
||||
p[5] += s0*s2;
|
||||
for (i = 0; i < (FRSZ - 2); i++)
|
||||
{
|
||||
s0 = *fp0++;
|
||||
s1 = *fp0++;
|
||||
s2 = *fp0--;
|
||||
p[8] += s0*s0;
|
||||
p[4] += s0*s1;
|
||||
p[5] += s0*s2;
|
||||
}
|
||||
s0 = *fp0++;
|
||||
s1 = *fp0++;
|
||||
s2 = *fp0--;
|
||||
p[7] = p[8] + (s0*s0) - t0;
|
||||
p[3] = p[4] + (s0*s1) - t1;
|
||||
p[6] = p[7] + (s1*s1) - t2;
|
||||
|
||||
cormax = -1.0e30;
|
||||
fp2 = bv16_pp9cb;
|
||||
for (i = 0; i < PPCBSZ; i++)
|
||||
{
|
||||
cor = 0.0;
|
||||
fp1 = p;
|
||||
for (j = 0; j < 9; j++)
|
||||
cor += (*fp2++)*(*fp1++);
|
||||
if (cor > cormax)
|
||||
{
|
||||
cormax = cor;
|
||||
qidx = i;
|
||||
}
|
||||
}
|
||||
|
||||
fp2 = bv16_pp9cb + qidx*9;
|
||||
for (i = 0; i < 3; i++)
|
||||
b[i] = fp2[i]*0.5;
|
||||
|
||||
fp0 = x + XOFF;
|
||||
fp1 = x + XOFF - ppm2 - 1;
|
||||
t = 0;
|
||||
for (i = 0; i < FRSZ; i++)
|
||||
{
|
||||
t0 = *fp0++ - b[0]*fp1[0] - b[1]*fp1[-1] - b[2]*fp1[-2];
|
||||
fp1++;
|
||||
t += t0*t0;
|
||||
}
|
||||
*re = t;
|
||||
return qidx;
|
||||
}
|
||||
|
|
@ -1,107 +0,0 @@
|
|||
/*****************************************************************************/
|
||||
/* BroadVoice(R)16 (BV16) Floating-Point ANSI-C Source Code */
|
||||
/* Revision Date: August 19, 2009 */
|
||||
/* Version 1.0 */
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Copyright 2000-2009 Broadcom Corporation */
|
||||
/* */
|
||||
/* This software is provided under the GNU Lesser General Public License, */
|
||||
/* version 2.1, as published by the Free Software Foundation ("LGPL"). */
|
||||
/* This program is distributed in the hope that it will be useful, but */
|
||||
/* WITHOUT ANY SUPPORT OR WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the LGPL for */
|
||||
/* more details. A copy of the LGPL is available at */
|
||||
/* http://www.broadcom.com/licenses/LGPLv2.1.php, */
|
||||
/* or by writing to the Free Software Foundation, Inc., */
|
||||
/* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
bv16strct.h : BV16 data structures
|
||||
|
||||
$Log: bv16strct.h,v $
|
||||
Revision 1.1.1.1 2009/11/19 12:10:48 steveu
|
||||
Start from Broadcom's code
|
||||
|
||||
Revision 1.1.1.1 2009/11/17 14:06:02 steveu
|
||||
start
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bv16cnst.h"
|
||||
#include "bvcommon.h"
|
||||
|
||||
#if !defined(_BV16STRCT_H_)
|
||||
#define _BV16STRCT_H_
|
||||
|
||||
struct bv16_decode_state_s
|
||||
{
|
||||
Float stsym[LPCO];
|
||||
Float ltsym[LTMOFF];
|
||||
Float lsppm[LPCO*LSPPORDER];
|
||||
Float lgpm[LGPORDER];
|
||||
Float lsplast[LPCO];
|
||||
Float prevlg[2];
|
||||
Float lmax; /* level-adaptation */
|
||||
Float lmin;
|
||||
Float lmean;
|
||||
Float x1;
|
||||
Float level;
|
||||
int16_t pp_last;
|
||||
int16_t ngfae;
|
||||
Float bq_last[3];
|
||||
int16_t nggalgc;
|
||||
Float estl_alpha_min;
|
||||
int16_t cfecount;
|
||||
uint32_t idum;
|
||||
Float E;
|
||||
Float per;
|
||||
Float atplc[LPCO + 1];
|
||||
Float ma_a;
|
||||
Float b_prv[2];
|
||||
Float xq[XQOFF];
|
||||
int pp_prv;
|
||||
};
|
||||
|
||||
struct bv16_encode_state_s
|
||||
{
|
||||
Float x[XOFF]; /* 8kHz down-sampled signal memory */
|
||||
Float xwd[XDOFF]; /* memory of DECF:1 decimated version of xw() */
|
||||
Float dq[XOFF]; /* quantized short-term pred error */
|
||||
Float dfm[DFO]; /* decimated xwd() filter memory */
|
||||
Float stpem[LPCO]; /* ST Pred. Error filter memory */
|
||||
Float stwpm[LPCO]; /* ST Weighting all-Pole Memory */
|
||||
Float stsym[LPCO]; /* ST Synthesis filter Memory */
|
||||
Float ltsym[MAXPP1 + FRSZ]; /* long-term synthesis filter memory */
|
||||
Float ltnfm[MAXPP1 + FRSZ]; /* long-term noise feedback filter memory */
|
||||
Float lsplast[LPCO];
|
||||
Float lsppm[LPCO*LSPPORDER]; /* LSP Predictor Memory */
|
||||
Float lgpm[LGPORDER];
|
||||
Float hpfzm[HPO];
|
||||
Float hpfpm[HPO];
|
||||
Float prevlg[2];
|
||||
Float lmax; /* level-adaptation */
|
||||
Float lmin;
|
||||
Float lmean;
|
||||
Float x1;
|
||||
Float level;
|
||||
int cpplast; /* pitch period pf the previous frame */
|
||||
Float old_A[LPCO + 1];
|
||||
Float stnfz[NSTORDER];
|
||||
Float stnfp[NSTORDER];
|
||||
};
|
||||
|
||||
struct BV16_Bit_Stream
|
||||
{
|
||||
int16_t lspidx[2];
|
||||
int16_t ppidx;
|
||||
int16_t bqidx;
|
||||
int16_t gidx;
|
||||
int16_t qvidx[FRSZ/VDIM];
|
||||
};
|
||||
|
||||
#endif /* BV16STRCT_H */
|
|
@ -1,406 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* tables.c -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv16tables.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bv16externs.h"
|
||||
|
||||
const Float bv16_lgclimit[] =
|
||||
{
|
||||
0.00000, 0.79102, 0.55664, 14.26563, 14.08398, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000,
|
||||
0.00000, 13.85156, 1.73047, 13.76758, 13.92773, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000,
|
||||
-1.96094, 8.91211, 7.83594, 14.09961, 13.77930, 0.91016, -2.41406, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000,
|
||||
-1.96094, 8.66992, 13.53125, 14.09570, 13.95117, 12.97461, 2.14648, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000,
|
||||
-1.47266, 9.29297, 13.92578, 13.89063, 13.87891, 13.93750, 12.20703, -4.99023, 0.00000, 0.00000, 0.00000, 0.00000,
|
||||
4.60547, 12.33398, 14.09180, 14.14258, 14.16016, 13.48633, 12.39063, 2.01172, 0.00000, 0.00000, 0.00000, 0.00000,
|
||||
10.66016, 10.72656, 13.83203, 13.68359, 13.93945, 13.77930, 13.09570, 10.17578, -0.15430, -2.92578, 0.00000, 0.00000,
|
||||
6.59375, 10.19531, 13.34375, 12.87305, 13.36719, 13.36328, 13.12891, 12.66797, 0.72852, 0.30078, 4.87109, 7.85742,
|
||||
2.64063, 9.52539, 9.85547, 10.35938, 10.63086, 12.92383, 12.70508, 12.65234, 8.96680, 1.32422, 4.86719, 7.81445,
|
||||
6.24805, 8.26758, 8.78125, 9.08594, 9.03125, 10.34180, 11.21875, 11.07227, 8.32617, 8.41992, 7.70313, 7.86133,
|
||||
6.18945, 6.71875, 7.98438, 7.37109, 7.50391, 7.69922, 9.09180, 8.73633, 6.91211, 7.68750, 7.22266, 3.50977,
|
||||
4.40430, 5.46484, 6.17773, 6.04492, 6.14063, 6.84766, 5.89063, 5.43750, 4.67188, 5.58008, 7.70898, 7.46094,
|
||||
3.39648, 5.41602, 5.40039, 4.77734, 4.59375, 4.63477, 6.43359, 3.54102, 4.37891, 3.70117, 6.64844, 4.74414,
|
||||
0.00000, 3.50000, 4.60352, 3.92188, 3.68164, 4.21680, 4.18750, 3.32617, 3.38867, 2.32813, 5.15039, 1.76563,
|
||||
0.00000, 1.10156, 3.04492, 3.18945, 2.60156, 2.43164, 2.91016, 1.48438, 0.43555, 0.44336, 1.50391, 1.75391,
|
||||
0.00000, -0.11914, -1.13672, 1.41602, 1.49609, 0.72852, 0.60352, -0.35352, -0.98242, -1.15039, -1.99414, 0.00000,
|
||||
0.00000, 0.00000, 0.00000, 1.36861, 1.18557, -0.36990, -4.01682, -2.21214, 0.00000, -1.33077, -3.04360, 0.00000,
|
||||
0.00000, 0.00000, 0.00000, 0.52843, 0.43190, 0.00000, 0.00000, -2.86324, 0.00000, 0.00000, 0.00000, 0.00000
|
||||
};
|
||||
|
||||
const Float bv16_lspecb1[] =
|
||||
{
|
||||
-0.0059814, -0.0075378, -0.0113449, -0.0002670, -0.0103607, -0.0055771, 0.0091400, -0.0032730,
|
||||
-0.0053177, -0.0019302, 0.0037079, -0.0106049, -0.0021820, -0.0003815, 0.0100098, 0.0037460,
|
||||
-0.0009308, -0.0001831, -0.0040741, -0.0110474, -0.0238800, -0.0042191, 0.0014114, -0.0061035,
|
||||
0.0031128, 0.0013046, 0.0076218, -0.0042191, -0.0073776, -0.0045013, -0.0051651, 0.0158539,
|
||||
-0.0023270, -0.0014496, -0.0036392, 0.0071030, 0.0026093, -0.0172119, -0.0009613, -0.0059662,
|
||||
-0.0081329, -0.0077362, 0.0091782, 0.0048294, 0.0101395, 0.0007172, 0.0030212, 0.0013885,
|
||||
0.0006104, 0.0040817, -0.0010300, -0.0081787, -0.0126343, -0.0218582, -0.0007629, -0.0092163,
|
||||
0.0090561, 0.0081329, 0.0096436, 0.0009613, 0.0011063, -0.0042572, 0.0038910, -0.0034485,
|
||||
-0.0044785, -0.0070572, -0.0158615, 0.0019913, 0.0087204, 0.0005951, 0.0022583, -0.0074539,
|
||||
0.0042114, 0.0052719, -0.0061417, 0.0057449, 0.0057068, -0.0022202, 0.0133896, 0.0077362,
|
||||
-0.0039902, -0.0037308, -0.0103226, -0.0064774, -0.0049667, -0.0043411, -0.0066986, -0.0186844,
|
||||
0.0035553, 0.0042877, 0.0199356, 0.0078812, 0.0031281, -0.0082245, -0.0142746, -0.0015106,
|
||||
0.0032806, 0.0013351, -0.0004501, 0.0149384, 0.0076141, 0.0033264, -0.0038376, -0.0110245,
|
||||
0.0010910, 0.0050964, 0.0128632, 0.0091553, 0.0088348, 0.0151443, 0.0096664, 0.0043411,
|
||||
-0.0047226, -0.0046234, 0.0096664, 0.0042496, -0.0064697, -0.0039902, -0.0056915, -0.0162430,
|
||||
-0.0000229, 0.0000000, 0.0265427, 0.0128021, 0.0049896, 0.0054398, 0.0008698, -0.0047150,
|
||||
-0.0074081, -0.0089569, -0.0175552, -0.0174561, -0.0057831, -0.0148010, 0.0076141, 0.0079803,
|
||||
-0.0019760, -0.0027161, -0.0077667, -0.0104675, -0.0090866, -0.0027542, 0.0306244, 0.0160751,
|
||||
-0.0044403, -0.0059509, -0.0128784, -0.0197525, -0.0304413, -0.0161133, 0.0037613, 0.0098114,
|
||||
-0.0001907, 0.0020599, 0.0160294, 0.0045853, -0.0091476, -0.0058670, 0.0226593, 0.0125122,
|
||||
-0.0057526, -0.0060425, -0.0029755, -0.0092010, 0.0054550, -0.0046692, -0.0137711, -0.0035477,
|
||||
-0.0022125, -0.0046158, -0.0083923, 0.0117264, 0.0248260, 0.0126343, 0.0082626, 0.0001907,
|
||||
-0.0016632, 0.0000076, -0.0051346, -0.0084305, -0.0128784, -0.0196915, -0.0223007, -0.0168076,
|
||||
0.0046158, 0.0114517, 0.0148926, 0.0092087, 0.0188599, -0.0058212, 0.0079727, 0.0046082,
|
||||
-0.0006714, -0.0006714, -0.0119095, -0.0186539, 0.0112305, -0.0053024, 0.0070267, -0.0016022,
|
||||
0.0114136, 0.0131760, 0.0045929, -0.0096207, 0.0138092, 0.0076675, 0.0137863, 0.0142441,
|
||||
0.0089951, 0.0114975, -0.0246811, -0.0092545, -0.0067444, -0.0065155, -0.0055161, -0.0072098,
|
||||
0.0116730, 0.0303574, 0.0396042, 0.0238495, 0.0113144, 0.0006714, -0.0080719, 0.0067749,
|
||||
0.0061035, 0.0072174, 0.0028000, -0.0075989, 0.0156174, 0.0043716, -0.0073624, -0.0141525,
|
||||
0.0069580, 0.0107727, 0.0140839, 0.0036621, 0.0325394, 0.0216980, 0.0056152, 0.0061188,
|
||||
0.0065002, 0.0056458, 0.0067139, 0.0007935, 0.0008087, -0.0099030, -0.0182724, -0.0288086,
|
||||
0.0147324, 0.0161285, 0.0276260, 0.0238800, 0.0214386, 0.0131302, 0.0047607, -0.0047836,
|
||||
-0.0083008, -0.0135345, -0.0167313, -0.0003433, -0.0090408, -0.0008469, -0.0017624, 0.0161667,
|
||||
-0.0031662, -0.0056992, -0.0011444, 0.0063324, -0.0090790, 0.0121918, 0.0022354, 0.0048523,
|
||||
-0.0050354, -0.0077744, -0.0103531, -0.0145035, -0.0191193, -0.0035934, -0.0159454, 0.0042343,
|
||||
0.0078888, 0.0054169, 0.0038223, -0.0016632, -0.0109177, -0.0039520, -0.0170212, -0.0018616,
|
||||
-0.0038910, -0.0082321, -0.0112686, 0.0100861, -0.0043945, -0.0049820, -0.0151062, 0.0018616,
|
||||
-0.0030060, -0.0051117, 0.0013962, 0.0250015, -0.0003738, -0.0045395, 0.0120697, 0.0071411,
|
||||
-0.0017471, -0.0031509, -0.0094299, -0.0154495, -0.0188980, -0.0264816, -0.0149384, 0.0071030,
|
||||
0.0070190, 0.0111084, 0.0142746, 0.0070648, -0.0085373, -0.0219345, 0.0042267, 0.0029221,
|
||||
-0.0084000, -0.0120621, -0.0198364, -0.0063629, 0.0110550, 0.0045700, 0.0082169, 0.0152664,
|
||||
-0.0012970, -0.0023575, 0.0041809, 0.0055084, 0.0066299, 0.0041122, 0.0141602, 0.0310822,
|
||||
-0.0008011, 0.0027390, -0.0027847, -0.0278168, -0.0051651, -0.0065536, -0.0094833, -0.0070724,
|
||||
0.0257950, 0.0224075, 0.0190277, 0.0123291, 0.0018692, -0.0124512, -0.0261765, -0.0093994,
|
||||
0.0024414, 0.0011520, -0.0020218, 0.0018616, 0.0149918, 0.0050735, -0.0103073, 0.0105972,
|
||||
0.0045166, 0.0086136, 0.0284348, 0.0160980, 0.0127563, 0.0124054, 0.0261307, 0.0190277,
|
||||
-0.0064392, -0.0072556, 0.0081406, 0.0079956, -0.0225372, -0.0159760, -0.0059891, -0.0012741,
|
||||
-0.0008316, 0.0018845, 0.0423431, 0.0217514, 0.0008698, -0.0041199, 0.0085602, 0.0102158,
|
||||
-0.0227127, -0.0309753, -0.0029831, -0.0045471, -0.0044708, -0.0003662, 0.0006409, 0.0024567,
|
||||
0.0003204, -0.0007782, 0.0007553, -0.0061646, -0.0099792, 0.0272598, 0.0179977, 0.0155029,
|
||||
-0.0022583, -0.0034180, -0.0074692, -0.0160370, -0.0401917, -0.0083847, -0.0189896, -0.0101929,
|
||||
0.0022202, 0.0045013, 0.0243607, 0.0083466, -0.0246048, 0.0046997, -0.0021439, 0.0023041,
|
||||
-0.0029678, -0.0052338, 0.0025406, 0.0110321, 0.0029221, -0.0056763, -0.0311356, -0.0081024,
|
||||
0.0019226, 0.0010529, 0.0046844, 0.0322113, 0.0202255, 0.0150070, 0.0069733, 0.0021973,
|
||||
0.0002441, 0.0029984, 0.0021286, 0.0054932, -0.0150223, -0.0383453, -0.0137787, -0.0153046,
|
||||
0.0024185, 0.0418625, 0.0316925, 0.0256805, 0.0141296, 0.0077591, 0.0154495, 0.0091095,
|
||||
-0.0076904, -0.0126266, -0.0251846, -0.0261307, 0.0040588, 0.0132675, 0.0196609, 0.0226059,
|
||||
0.0066910, 0.0088730, 0.0157623, 0.0102997, 0.0193558, 0.0230255, 0.0201874, 0.0446930,
|
||||
-0.0050049, -0.0121231, -0.0460205, -0.0182266, -0.0260468, -0.0259018, -0.0209122, -0.0175323,
|
||||
0.0057602, 0.0139847, 0.0579147, 0.0351944, -0.0040665, -0.0186386, -0.0284729, -0.0171432,
|
||||
0.0025711, 0.0053101, 0.0119553, 0.0070419, 0.0170135, 0.0213165, -0.0242462, -0.0078735,
|
||||
0.0176849, 0.0341110, 0.0360947, 0.0325394, 0.0362167, 0.0317612, 0.0233765, 0.0178757,
|
||||
0.0018082, 0.0054245, 0.0223770, 0.0096283, -0.0214233, -0.0161209, -0.0263824, -0.0237961,
|
||||
0.0040436, 0.0186539, 0.0682678, 0.0692520, 0.0290146, 0.0145493, 0.0086975, 0.0001144,
|
||||
-0.0073166, -0.0097580, -0.0165558, -0.0164719, -0.0054932, 0.0104904, 0.0003052, -0.0026093,
|
||||
0.0012283, 0.0010452, -0.0012741, -0.0147095, 0.0082169, 0.0179520, 0.0043182, 0.0050583,
|
||||
-0.0025101, -0.0054626, -0.0107498, -0.0207672, -0.0277328, 0.0124207, 0.0075836, 0.0025177,
|
||||
0.0082932, 0.0077057, 0.0032272, -0.0084229, -0.0114975, 0.0151215, 0.0005341, -0.0019226,
|
||||
-0.0067825, -0.0089111, -0.0184479, 0.0017242, -0.0064545, -0.0217209, -0.0024490, -0.0019455,
|
||||
-0.0006104, -0.0049820, 0.0121994, 0.0176392, 0.0069962, 0.0066605, -0.0074310, 0.0169830,
|
||||
-0.0000534, 0.0012283, -0.0020981, -0.0062180, -0.0171661, -0.0240707, 0.0151367, 0.0081100,
|
||||
0.0176697, 0.0149918, 0.0140686, 0.0097809, 0.0034790, 0.0105209, 0.0014572, 0.0027390,
|
||||
-0.0064240, -0.0083618, -0.0160828, -0.0105820, 0.0212021, 0.0123367, -0.0018921, -0.0081329,
|
||||
-0.0053406, -0.0044250, -0.0000076, 0.0004807, 0.0158310, 0.0097198, 0.0251846, 0.0064545,
|
||||
-0.0037766, -0.0038528, -0.0154724, -0.0229874, 0.0008011, 0.0042114, -0.0171432, -0.0225220,
|
||||
0.0014191, 0.0062637, 0.0232925, 0.0124817, 0.0117035, 0.0014648, -0.0106812, -0.0250015,
|
||||
-0.0061264, -0.0116348, -0.0150681, 0.0248032, 0.0146561, 0.0051270, -0.0047836, -0.0073013,
|
||||
-0.0086670, -0.0107346, 0.0193634, 0.0210648, 0.0206528, 0.0170822, 0.0147781, 0.0120239,
|
||||
-0.0034256, -0.0035858, -0.0015869, -0.0019073, -0.0142975, 0.0131302, -0.0151138, -0.0197067,
|
||||
-0.0020447, 0.0006714, 0.0414658, 0.0249710, 0.0197296, 0.0175705, -0.0016098, 0.0003967,
|
||||
-0.0080795, -0.0119095, -0.0216980, -0.0280533, -0.0105896, -0.0002365, -0.0009079, 0.0161667,
|
||||
0.0123291, 0.0056229, -0.0075455, -0.0211258, -0.0128326, 0.0001068, 0.0061417, 0.0149689,
|
||||
-0.0029373, -0.0080795, -0.0181351, -0.0304947, -0.0477219, 0.0010223, 0.0070724, 0.0156937,
|
||||
0.0141983, 0.0176315, 0.0056763, -0.0044098, -0.0164795, 0.0085678, 0.0159912, 0.0168228,
|
||||
-0.0061722, -0.0097046, -0.0205307, -0.0133286, 0.0058441, -0.0068512, -0.0228195, 0.0043335,
|
||||
-0.0051880, -0.0111084, -0.0178680, 0.0235138, 0.0195084, 0.0178680, 0.0160370, 0.0151443,
|
||||
0.0019531, -0.0010757, -0.0006256, -0.0082626, -0.0146942, -0.0227509, -0.0364304, 0.0097427,
|
||||
0.0283661, 0.0346222, 0.0130768, 0.0101700, 0.0174866, 0.0197144, 0.0173874, 0.0145874,
|
||||
-0.0066528, -0.0088272, -0.0246811, -0.0331345, 0.0143738, 0.0057602, -0.0002747, -0.0007629,
|
||||
0.0018539, 0.0035934, -0.0006332, -0.0124893, 0.0327225, 0.0176163, 0.0233994, 0.0193710,
|
||||
-0.0135727, -0.0340042, -0.0894012, -0.0189590, -0.0093231, -0.0084381, -0.0090332, -0.0088577,
|
||||
0.0099640, 0.0462646, 0.0453796, 0.0276489, 0.0160370, 0.0025406, -0.0106049, -0.0192184,
|
||||
-0.0034714, -0.0054245, -0.0114441, 0.0039444, 0.0178375, 0.0054550, -0.0171051, -0.0267639,
|
||||
-0.0011978, 0.0003204, 0.0082169, 0.0209274, 0.0536499, 0.0358963, 0.0197830, 0.0092850,
|
||||
0.0023346, 0.0034943, -0.0014572, 0.0014343, -0.0054932, -0.0127716, -0.0328522, -0.0487366,
|
||||
0.0088501, 0.0262756, 0.0493164, 0.0377655, 0.0499496, 0.0279236, -0.0018158, -0.0138168,
|
||||
-0.0091782, -0.0182266, -0.0430679, 0.0019302, 0.0016556, 0.0016785, -0.0005188, -0.0010605,
|
||||
-0.0042267, -0.0044327, -0.0011826, 0.0068283, 0.0034714, 0.0279465, 0.0020370, -0.0107651,
|
||||
-0.0088577, -0.0077744, -0.0206451, -0.0217667, -0.0166931, -0.0166321, -0.0041122, -0.0111160,
|
||||
0.0114822, 0.0137863, 0.0051422, 0.0017090, -0.0126801, -0.0010223, -0.0035172, -0.0167770,
|
||||
-0.0047989, -0.0082703, -0.0190659, 0.0137558, -0.0056305, -0.0116806, -0.0150452, -0.0211258,
|
||||
-0.0013351, -0.0021439, 0.0114136, 0.0434952, 0.0037308, -0.0042496, -0.0063400, -0.0076370,
|
||||
-0.0027390, -0.0010986, -0.0103989, -0.0135803, -0.0289612, -0.0440826, 0.0028915, 0.0004730,
|
||||
0.0343170, 0.0352859, 0.0218124, 0.0093842, -0.0054703, -0.0086594, 0.0062637, 0.0050507,
|
||||
-0.0057678, -0.0092545, -0.0224991, -0.0150681, 0.0306778, 0.0213089, 0.0150299, 0.0065155,
|
||||
-0.0029221, -0.0022583, 0.0017624, 0.0089951, 0.0164185, 0.0172653, 0.0484390, 0.0271988,
|
||||
-0.0026627, 0.0002594, -0.0224304, -0.0537415, -0.0119095, -0.0128479, -0.0069809, -0.0067749,
|
||||
0.0076294, 0.0422287, 0.0109787, 0.0002823, 0.0060196, 0.0020523, -0.0027847, -0.0075226,
|
||||
-0.0038986, -0.0030670, 0.0042572, 0.0127869, 0.0384750, 0.0027542, -0.0117798, -0.0054169,
|
||||
-0.0036087, 0.0035782, 0.0424576, 0.0331345, 0.0332794, 0.0281830, 0.0280609, 0.0207291,
|
||||
0.0046082, 0.0080490, 0.0111084, -0.0065918, -0.0519485, -0.0157547, -0.0019455, -0.0029144,
|
||||
0.0034485, 0.0175858, 0.0821762, 0.0272980, 0.0156860, 0.0159531, 0.0184174, 0.0143356,
|
||||
-0.0314102, -0.0573120, -0.0361557, -0.0185471, -0.0215912, -0.0093765, -0.0097656, -0.0018997,
|
||||
0.0007401, 0.0014343, 0.0100021, 0.0084229, 0.0087585, 0.0477676, 0.0178299, 0.0107193,
|
||||
-0.0015106, -0.0081024, -0.0302200, -0.0461807, -0.0730972, -0.0303497, -0.0201721, -0.0060349,
|
||||
0.0099411, 0.0259781, 0.0389252, -0.0061798, -0.0111618, 0.0061264, 0.0084991, -0.0016098,
|
||||
-0.0020447, -0.0056534, -0.0065460, -0.0004425, -0.0104218, -0.0178070, -0.0585556, -0.0127106,
|
||||
-0.0028152, -0.0029221, 0.0108337, 0.0616455, 0.0292282, 0.0216827, 0.0112686, 0.0042725,
|
||||
0.0102158, 0.0152206, -0.0010757, -0.0186920, -0.0433731, -0.0584030, -0.0330887, -0.0182495,
|
||||
0.0341263, 0.0759430, 0.0464096, 0.0330963, 0.0261612, 0.0209045, 0.0158920, 0.0113602,
|
||||
-0.0082016, -0.0157471, -0.0547714, -0.0575638, 0.0062866, 0.0029297, 0.0097733, 0.0060959,
|
||||
0.0022659, 0.0080261, 0.0222321, 0.0229797, 0.0417252, 0.0456924, 0.0649796, 0.0428009,
|
||||
-0.0109406, -0.0265427, -0.0845337, -0.0739746, -0.0471725, -0.0384445, -0.0217361, -0.0125504,
|
||||
0.0284500, 0.0826721, 0.1126251, 0.0532761, 0.0114975, -0.0184174, -0.0278168, -0.0385132,
|
||||
-0.0009766, -0.0013504, 0.0082321, 0.0411072, 0.0223083, 0.0020828, -0.0291138, -0.0363312,
|
||||
0.0068207, 0.0242920, 0.0580826, 0.0683975, 0.0789490, 0.0621414, 0.0445786, 0.0190887,
|
||||
0.0293198, 0.0630722, 0.0497131, -0.0120468, -0.0440521, -0.0440979, -0.0299225, -0.0291214,
|
||||
0.0271988, 0.0838776, 0.1353760, 0.1022873, 0.0741501, 0.0458984, 0.0275192, -0.0002823
|
||||
};
|
||||
|
||||
const Float bv16_lspecb2[] =
|
||||
{
|
||||
-0.00045776, 0.00002289, 0.00099182, 0.00270081, 0.00746155, 0.00529480, -0.00106049, -0.00178528,
|
||||
-0.00029755, -0.00101471, -0.00086212, 0.00087738, -0.00106049, 0.00087738, -0.01163483, 0.00027466,
|
||||
-0.00118256, -0.00199127, -0.00380707, -0.00403595, -0.00030518, 0.00240326, 0.00474548, 0.00889587,
|
||||
-0.00337219, -0.00188446, 0.00494385, -0.00525665, 0.00161743, -0.00501251, 0.00176239, 0.00527191,
|
||||
0.00021362, 0.00082397, -0.00271606, -0.00733185, 0.00150299, 0.00543213, 0.00144958, -0.00333405,
|
||||
-0.00189972, -0.00291443, -0.00379944, -0.00436401, -0.00100708, -0.00173187, -0.00433350, -0.00628662,
|
||||
-0.00256348, -0.00302124, -0.00202942, 0.00238037, -0.00732422, 0.00712585, 0.00381470, 0.00191498,
|
||||
-0.00487518, -0.00572205, 0.00082397, 0.00188446, -0.00714111, -0.00489044, -0.00206757, -0.00262451,
|
||||
-0.00010681, -0.00145721, -0.00476074, 0.00331116, 0.01039886, -0.00167847, 0.00269318, 0.00548553,
|
||||
-0.00064850, -0.00139618, -0.00781250, -0.00374603, 0.00415039, -0.00397491, -0.00685883, 0.00500488,
|
||||
-0.00432587, -0.00485229, -0.00765228, 0.00385284, 0.00276184, -0.00205231, 0.00595856, -0.00077057,
|
||||
-0.01011658, 0.00389099, -0.00176239, 0.00331116, 0.00072479, -0.00367737, -0.00161743, -0.00171661,
|
||||
-0.00463867, -0.00547791, -0.00512695, -0.00231171, 0.00556183, 0.00563049, -0.00107574, 0.00090027,
|
||||
-0.00424957, -0.00586700, -0.00111389, 0.00374603, 0.00692749, -0.00564575, -0.00616455, -0.00193024,
|
||||
-0.00263214, -0.00723267, -0.00938416, 0.00535583, -0.00386810, 0.00198364, -0.00283813, 0.00453949,
|
||||
0.00451660, -0.01326752, -0.00163269, -0.00040436, 0.00058746, -0.00355530, -0.00116730, -0.00093842,
|
||||
0.00000763, 0.00039673, 0.00560760, -0.00251770, 0.00186157, 0.01089478, -0.00137329, 0.00457001,
|
||||
-0.00207520, -0.00434113, 0.00380707, 0.00775909, -0.00274658, 0.00917053, -0.00515747, -0.00215149,
|
||||
-0.00079346, -0.00209808, 0.00601196, -0.00038147, -0.00785828, 0.00248718, -0.00209808, 0.01184082,
|
||||
-0.00298309, -0.00412750, 0.01414490, 0.00212097, -0.00019073, -0.00061798, -0.00274658, 0.00065613,
|
||||
0.00035858, 0.00170898, 0.00259399, -0.01609802, -0.00000763, 0.00162506, -0.00133514, 0.00100708,
|
||||
-0.00503540, -0.00462341, 0.00434875, -0.00257874, 0.00315094, 0.00467682, 0.00090790, -0.01029968,
|
||||
-0.00057220, -0.00221252, -0.00485992, -0.00782013, -0.00888824, 0.00464630, -0.00598145, 0.00544739,
|
||||
-0.00719452, -0.01031494, 0.00247192, -0.00617218, -0.00236511, 0.00193024, -0.00309753, 0.00254059,
|
||||
-0.00290680, -0.00582886, 0.00511169, 0.00539398, 0.00604248, 0.00421143, 0.00669861, 0.00392151,
|
||||
-0.00224304, -0.00450134, 0.00026703, 0.00598907, 0.00528717, 0.00506592, -0.00660706, 0.01150513,
|
||||
-0.00428772, -0.00616455, 0.00080872, 0.00531769, -0.00407410, -0.00506592, 0.00903320, 0.00828552,
|
||||
-0.01528931, -0.00518799, 0.00449371, 0.00463104, 0.00074005, 0.00062561, 0.00030518, 0.00215912,
|
||||
-0.00177765, -0.00195313, -0.00070953, -0.01091003, 0.01485443, 0.00244141, 0.00580597, -0.00041199,
|
||||
-0.00414276, -0.00515747, -0.00126648, 0.00601959, 0.01933289, 0.00696564, -0.00712585, -0.00523376,
|
||||
-0.00677490, -0.01074219, -0.01129150, -0.00234985, -0.00765991, -0.00885773, 0.00039673, 0.00651550,
|
||||
-0.00891113, -0.01766968, 0.00561523, 0.00578308, 0.00490570, 0.00194550, -0.00356293, -0.00082397,
|
||||
-0.00096130, -0.00098419, -0.00413513, 0.00173950, 0.00495911, 0.01183319, 0.00845337, -0.00122833,
|
||||
-0.00326538, -0.00333405, 0.00357056, -0.00922394, 0.00468445, 0.00469971, -0.01351166, -0.00124359,
|
||||
-0.00380707, -0.00453949, -0.00596619, -0.00867462, -0.00395966, -0.00065613, 0.00699615, -0.00128174,
|
||||
-0.00752258, -0.00469208, 0.00773621, -0.00899506, 0.00354004, -0.01000214, 0.00416565, -0.00489044,
|
||||
0.00000763, -0.00075531, -0.00958252, -0.00546265, -0.00563049, 0.01355743, 0.00136566, -0.01033783,
|
||||
-0.00630951, -0.00655365, -0.00659943, 0.00173950, -0.00452423, 0.00329590, -0.00886536, -0.01154327,
|
||||
-0.00095367, -0.00313568, -0.00857544, 0.00354767, -0.01430511, 0.00208282, 0.00795746, -0.00600433,
|
||||
-0.00719452, -0.01290894, 0.00675201, 0.00386047, -0.01235962, -0.00559235, 0.00556183, -0.00572968,
|
||||
-0.00801086, -0.00989532, -0.00411224, -0.00192261, 0.01290894, -0.00526428, 0.00534058, 0.01023865,
|
||||
-0.00186920, -0.00344086, -0.00266266, -0.01030731, 0.00197601, -0.00857544, -0.01191711, 0.01605988,
|
||||
-0.00836945, -0.00853729, -0.00543976, 0.00074005, 0.00202942, -0.00057983, 0.01557922, -0.00852203,
|
||||
-0.01739502, 0.00542450, -0.00310516, -0.00865936, -0.00068665, 0.00004578, 0.00126648, 0.00104523,
|
||||
-0.00631714, -0.01346588, -0.01500702, -0.00602722, 0.00646210, 0.01339722, -0.00647736, -0.00049591,
|
||||
-0.00720215, -0.01295471, -0.00642395, -0.00480652, 0.01066589, -0.01364136, -0.01339722, -0.00752258,
|
||||
-0.00552368, -0.01621246, -0.01331329, 0.01739502, -0.00738525, 0.00836182, 0.00555420, 0.00202942,
|
||||
0.00701904, -0.02751923, 0.00681305, 0.00177765, -0.00151062, -0.00057220, 0.00139618, 0.00026703,
|
||||
0.00125885, 0.00099945, 0.00302887, -0.00566864, -0.00022125, 0.02838135, -0.00177765, 0.00128937,
|
||||
-0.00152588, -0.00276184, 0.01119232, 0.00526428, -0.00367737, 0.01557159, -0.01921844, -0.00600433,
|
||||
-0.00518036, -0.00488281, 0.00891876, -0.00863647, -0.00762939, 0.00898743, 0.00974274, 0.00371552,
|
||||
-0.00656891, -0.00149536, 0.02567291, -0.01044464, -0.00462341, -0.00055695, -0.00331879, -0.00172424,
|
||||
0.00264740, 0.00337219, -0.00964355, -0.03454590, 0.00086975, 0.01454163, 0.00080109, 0.00027466,
|
||||
-0.00373077, -0.00283813, 0.00484467, -0.00320435, 0.00572968, 0.00675201, -0.00530243, -0.03117371,
|
||||
-0.00197601, -0.01000214, -0.00423431, -0.00650787, -0.02683258, 0.01259613, -0.00359344, 0.00352478,
|
||||
-0.01738739, -0.02180481, 0.00868988, -0.01496887, -0.00506592, -0.00038147, -0.00035858, 0.00020599,
|
||||
-0.00734711, -0.00748444, 0.01610565, 0.00942993, 0.01790619, 0.01776123, 0.01367950, 0.01322937,
|
||||
-0.00354767, -0.00787354, -0.00128937, 0.00877380, -0.00132751, 0.00061798, -0.02446747, 0.01464081,
|
||||
-0.00668335, -0.00952911, 0.00102997, 0.00148010, -0.00872040, 0.00305176, 0.03495026, 0.01872253,
|
||||
-0.03459930, 0.00503540, 0.00631714, 0.00146484, 0.00110626, -0.00109100, -0.00064850, 0.00020599,
|
||||
-0.00075531, -0.00411224, -0.02098846, -0.01145172, 0.03794098, 0.02877808, 0.01161194, 0.00054932,
|
||||
-0.00887299, -0.02392578, -0.01149750, 0.03517151, 0.02966309, 0.00566864, -0.02129364, -0.02059937,
|
||||
-0.01180267, -0.03713226, -0.03850555, -0.00773621, -0.01717377, -0.01065826, -0.00489044, -0.00129700,
|
||||
-0.02636719, -0.04943848, 0.01272583, 0.01393127, 0.00457001, 0.00045776, 0.00072479, 0.00040436
|
||||
};
|
||||
|
||||
const Float bv16_lspmean[] = /* mean value of LSP components */
|
||||
{
|
||||
0.0950317, 0.1489563, 0.2513123, 0.3629456, 0.4780884, 0.5877075, 0.7058105, 0.8007202
|
||||
};
|
||||
|
||||
const Float bv16_lspp[] = /* LSP Predictor Coefficients */
|
||||
{
|
||||
1.040710, 0.844971, 0.682922, 0.575989, 0.464600, 0.346008, 0.226074, 0.103577,
|
||||
1.034851, 0.884094, 0.723816, 0.609863, 0.489563, 0.366516, 0.240234, 0.109253,
|
||||
1.055237, 0.922180, 0.762695, 0.644531, 0.512695, 0.373474, 0.238037, 0.108337,
|
||||
1.076843, 0.935608, 0.790771, 0.673523, 0.540588, 0.399841, 0.264221, 0.118774,
|
||||
1.065552, 0.901978, 0.746155, 0.636047, 0.514282, 0.386169, 0.256165, 0.117493,
|
||||
1.037476, 0.848816, 0.684326, 0.577393, 0.463684, 0.347717, 0.232666, 0.107239,
|
||||
1.022278, 0.809021, 0.645081, 0.535767, 0.430481, 0.325562, 0.219055, 0.099304,
|
||||
0.964844, 0.743469, 0.578125, 0.484375, 0.393250, 0.297913, 0.201416, 0.091736
|
||||
};
|
||||
|
||||
const Float bv16_lgpecb[] = /* Log-Gain Prediction Error CodeBook */
|
||||
{
|
||||
-5.38477, -3.68066, -2.76855, -2.09717, -1.47217, -0.33984, 0.67285, 1.82031,
|
||||
-0.88525, 0.16748, 1.20313, 2.62549, 3.80518, 5.64551, 8.70605, 11.85156
|
||||
};
|
||||
|
||||
const Float bv16_lgp[] =
|
||||
{
|
||||
0.7801514, 0.7377625, 0.6150818, 0.5926208, 0.4674072, 0.3635864, 0.2378540, 0.1286926
|
||||
};
|
||||
|
||||
const Float bv16_lgmean = 11.45752;
|
||||
|
||||
const Float bv16_cccb[] =
|
||||
{
|
||||
-0.514526, 0.847412, 0.166748, 0.120605,
|
||||
0.389648, 1.125000, -1.070557, 0.048584,
|
||||
-0.263916, -0.053101, 0.189209, 0.177734,
|
||||
2.927368, -0.262695, -0.092896, 0.274292,
|
||||
-0.348755, -0.356812, -0.765747, -0.639038,
|
||||
1.912231, 0.890869, -2.045654, -0.802124,
|
||||
-0.180298, -1.221802, -1.728760, -0.965210,
|
||||
1.743286, -1.338379, 0.184204, -0.281128,
|
||||
-1.407593, 1.109497, 1.724487, -0.347900,
|
||||
2.324219, 1.637939, 0.742188, 0.526001,
|
||||
-0.330933, -0.405396, 0.890747, 1.477661,
|
||||
1.545532, -0.195068, 0.148560, 0.073486,
|
||||
-0.583740, 0.456055, 0.253296, -1.269043,
|
||||
0.587769, -0.129028, 0.616699, -0.256714,
|
||||
-1.211426, -0.743896, -0.608887, -0.219360,
|
||||
0.196289, -1.870728, -0.309326, 1.111694
|
||||
};
|
||||
|
||||
const Float bv16_pp9cb[PPCBSZ*9] =
|
||||
{
|
||||
-0.022522, -0.353455, 0.002197, -0.003967, 0.000366, 0.000000, -0.000122, -0.031250, 0.000000,
|
||||
-0.426147, 0.989624, 0.063049, 0.210876, -0.031189, 0.013428, -0.045410, -0.244812, -0.000977,
|
||||
0.337036, -1.186096, 0.409424, 0.199890, 0.242798, -0.068970, -0.028381, -0.351685, -0.041931,
|
||||
0.262207, 0.473328, 0.251770, -0.062073, -0.059570, -0.033020, -0.017212, -0.056030, -0.015869,
|
||||
0.534241, 0.753235, 0.150085, -0.201172, -0.056519, -0.040100, -0.071350, -0.141846, -0.005615,
|
||||
0.545532, 1.699646, -0.329407, -0.463623, 0.279907, 0.089844, -0.074402, -0.722168, -0.027100,
|
||||
0.283752, 0.565430, -0.156372, -0.080200, 0.044189, 0.022217, -0.020142, -0.079956, -0.006104,
|
||||
0.838562, 1.034973, 0.089111, -0.433960, -0.046143, -0.037354, -0.175781, -0.267761, -0.002014,
|
||||
-0.158081, 0.575684, -0.197205, 0.045471, 0.056763, -0.015564, -0.006226, -0.082825, -0.009705,
|
||||
0.020447, 1.079346, -0.422424, -0.011047, 0.227966, 0.004333, -0.000122, -0.291260, -0.044617,
|
||||
0.236511, -0.646912, -0.251587, 0.076538, -0.081360, 0.029785, -0.013977, -0.104614, -0.015808,
|
||||
0.116882, 0.874512, 0.108887, -0.051086, -0.047607, -0.006348, -0.003418, -0.191162, -0.002991,
|
||||
0.535400, 1.342102, -0.004028, -0.359253, 0.002686, 0.001099, -0.071655, -0.450317, 0.000000,
|
||||
0.102112, 1.911194, -0.150574, -0.097534, 0.143860, 0.007690, -0.002625, -0.913147, -0.005676,
|
||||
0.576660, 0.916931, -0.272522, -0.264404, 0.124939, 0.078552, -0.083130, -0.210205, -0.018555,
|
||||
0.921509, 1.341675, -0.355408, -0.618164, 0.238403, 0.163757, -0.212280, -0.450012, -0.031555,
|
||||
0.053589, 0.331238, 0.060120, -0.008850, -0.009949, -0.001587, -0.000732, -0.027405, -0.000916,
|
||||
-0.334106, 1.298950, 0.939758, 0.216980, -0.610352, 0.156982, -0.027893, -0.421814, -0.220764,
|
||||
0.198242, -0.586304, 0.324402, 0.058105, 0.095093, -0.032166, -0.009827, -0.085938, -0.026306,
|
||||
0.101135, 0.724731, 0.504761, -0.036621, -0.182922, -0.025513, -0.002563, -0.131287, -0.063721,
|
||||
0.157104, 0.999268, 0.802124, -0.078491, -0.400757, -0.062988, -0.006165, -0.249634, -0.160828,
|
||||
-0.035217, 1.416809, 0.517395, 0.024963, -0.366516, 0.009094, -0.000305, -0.501831, -0.066895,
|
||||
0.446411, 0.646851, 0.513916, -0.144409, -0.166199, -0.114685, -0.049805, -0.104614, -0.066040,
|
||||
0.547058, 0.942505, 0.471069, -0.257813, -0.221985, -0.128845, -0.074829, -0.222107, -0.055481,
|
||||
-0.173523, 0.558838, 0.263611, 0.048462, -0.073669, 0.022888, -0.007507, -0.078064, -0.017395,
|
||||
-0.424072, 1.610962, 0.640259, 0.341553, -0.515747, 0.135742, -0.044983, -0.648804, -0.102478,
|
||||
-0.355591, -0.702820, 0.022034, -0.124939, 0.007751, 0.003906, -0.031616, -0.123474, -0.000122,
|
||||
-0.244446, 0.940491, 0.598267, 0.114929, -0.281311, 0.073120, -0.014954, -0.221130, -0.089478,
|
||||
0.347046, 1.152039, 0.385620, -0.199890, -0.222168, -0.066895, -0.030090, -0.331787, -0.037170,
|
||||
-0.189636, 1.869568, 0.246582, 0.177246, -0.230469, 0.023376, -0.008972, -0.873840, -0.015198,
|
||||
0.635010, 0.814880, 0.510864, -0.258728, -0.208130, -0.162231, -0.100830, -0.166016, -0.065247,
|
||||
0.191528, 1.579285, 0.121948, -0.151245, -0.096313, -0.011658, -0.009155, -0.623535, -0.003723
|
||||
};
|
||||
|
||||
/* Front-end highpass filter */
|
||||
const Float bv16_hpfa[] = {1.000000, -1.899109, 0.905396};
|
||||
const Float bv16_hpfb[] = {0.924133, -1.848267, 0.924133};
|
||||
|
||||
/* coarse pitch search */
|
||||
const Float bv16_adf[] = {1.00000000000000, -2.95802363194525, 3.63373126275837, -2.12495286948979, 0.50039692036808};
|
||||
const Float bv16_bdf[] = {0.04330826, -0.06871796, 0.09910965, -0.06871796, 0.04330826};
|
||||
const Float bv16_x[] = {0.25, 0.5};
|
||||
const Float bv16_x2[] = {0.0625, 0.25}; /* square of x[] */
|
||||
const Float bv16_MPTH[]= {0.6300049, 0.4800110, 0.4200134, 0.3599854};
|
||||
|
||||
const Float bv16_winl[] =
|
||||
{
|
||||
0.0001221, 0.0004883, 0.0011292, 0.0019836, 0.0031128, 0.0044556, 0.0060730, 0.0079346,
|
||||
0.0100098, 0.0123596, 0.0149536, 0.0177612, 0.0208130, 0.0241394, 0.0276794, 0.0314331,
|
||||
0.0354309, 0.0396729, 0.0441284, 0.0488281, 0.0537415, 0.0588684, 0.0642395, 0.0697937,
|
||||
0.0755920, 0.0815735, 0.0877686, 0.0941772, 0.1007996, 0.1076050, 0.1145935, 0.1217957,
|
||||
0.1291809, 0.1367493, 0.1444702, 0.1524048, 0.1604919, 0.1687622, 0.1771851, 0.1857605,
|
||||
0.1945190, 0.2033997, 0.2124634, 0.2216492, 0.2309570, 0.2404175, 0.2500000, 0.2597046,
|
||||
0.2695313, 0.2794800, 0.2895203, 0.2996826, 0.3099365, 0.3202820, 0.3307495, 0.3412476,
|
||||
0.3518677, 0.3625488, 0.3732910, 0.3840942, 0.3949585, 0.4058838, 0.4168396, 0.4278259,
|
||||
0.4388733, 0.4499512, 0.4610596, 0.4721680, 0.4833069, 0.4944153, 0.5055847, 0.5166931,
|
||||
0.5278320, 0.5389404, 0.5500488, 0.5611267, 0.5721741, 0.5831604, 0.5941162, 0.6050415,
|
||||
0.6159058, 0.6267090, 0.6374512, 0.6481323, 0.6587524, 0.6692505, 0.6797180, 0.6900635,
|
||||
0.7003174, 0.7104797, 0.7205200, 0.7304688, 0.7402954, 0.7500000, 0.7595825, 0.7690430,
|
||||
0.7783508, 0.7875366, 0.7966003, 0.8054810, 0.8142395, 0.8228149, 0.8312378, 0.8395081,
|
||||
0.8475952, 0.8555298, 0.8632507, 0.8708191, 0.8782043, 0.8854065, 0.8923950, 0.8992004,
|
||||
0.9058228, 0.9122314, 0.9184265, 0.9244080, 0.9302063, 0.9357605, 0.9411316, 0.9462585,
|
||||
0.9511719, 0.9558716, 0.9603271, 0.9645691, 0.9685669, 0.9723206, 0.9758606, 0.9791870,
|
||||
0.9822388, 0.9850464, 0.9876404, 0.9899902, 0.9920654, 0.9939270, 0.9955444, 0.9968872,
|
||||
0.9980164, 0.9988708, 0.9995117, 0.9998779, 1.0000000, 0.9969177, 0.9877014, 0.9723816,
|
||||
0.9510498, 0.9238892, 0.8910217, 0.8526306, 0.8090210, 0.7604065, 0.7070923, 0.6494446,
|
||||
0.5877991, 0.5224915, 0.4539795, 0.3826904, 0.3090210, 0.2334595, 0.1564331, 0.0784607
|
||||
};
|
||||
|
||||
const Float bv16_sstwin[] =
|
||||
{
|
||||
1.00009999953429, 0.99950664069252, 0.99802802477777, 0.99556852473654, 0.99213540467992,
|
||||
0.98773878257675, 0.98239158368278, 0.97610947534163, 0.96891079060864
|
||||
};
|
||||
|
||||
/* pole-zero noise feedback filter */
|
||||
const Float bv16_gfsz[] =
|
||||
{
|
||||
0.00000000000000, -0.40000000000000, -0.54000000000000, -0.56275000000000,
|
||||
-0.53527500000000, -0.48872828125000, -0.43730950781250, -0.38724014365234,
|
||||
-0.34101742974609
|
||||
};
|
||||
|
||||
const Float bv16_gfsp[] =
|
||||
{
|
||||
1.00000000000000, 0.87500000000000, 0.76562500000000, 0.66992187500000,
|
||||
0.58618164062500, 0.51290893554688, 0.44879531860352, 0.39269590377808,
|
||||
0.34360891580582
|
||||
};
|
||||
|
||||
const int bv16_idxord[] = { 0, 1, 2, 3, 4, 8, 5, 9, 6, 10, 7, 11, 12, 13, 14, 15 };
|
||||
|
||||
const Float bv16_lgpecb_nh[] = /* Log-Gain Prediction Error Next-Higher CodeBook */
|
||||
{
|
||||
-3.68066, -2.76855, -2.09717, -1.47217, -0.88525, 0.16748, 1.20313, 2.62549,
|
||||
-0.33984, 0.67285, 1.82031, 3.80518, 5.64551, 8.70605, 11.85156
|
||||
};
|
|
@ -1,152 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* bv32cnst.h -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv32cnst.h,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
#include "typedef.h"
|
||||
|
||||
#ifndef __BV32__
|
||||
#define __BV32__
|
||||
|
||||
/* ----- Basic Codec Parameters ----- */
|
||||
#define SF 16 /* input Sampling Frequency (in kHz) */
|
||||
#define FRSZ 80 /* the FRame SiZe */
|
||||
#define MAXPP 265 /* MAXimum Pitch Period */
|
||||
#define MINPP 10 /* Half of MINimum Pitch Period */
|
||||
#define NSF 2 /* number of subframes per frame */
|
||||
#define PWSZ 240 /* Pitch analysis Window SiZe for 8kHz lowband */
|
||||
#define SFRSZ (FRSZ/NSF) /* SubFrame SiZe */
|
||||
#define WINSZ 160 /* Half of LPC analysis WINdow SiZe */
|
||||
#define MAXPP1 (MAXPP+1) /* Half of MAXimum Pitch Period + 1a */
|
||||
|
||||
/* NFC VQ coding parameters */
|
||||
#define VDIM 4 /* excitation vector dimension */
|
||||
#define CBSZ 32 /* codebook size */
|
||||
#define PPCBSZ 32
|
||||
#define LGPORDER 16 /* Log-Gain Predictor OODER */
|
||||
#define LGPECBSZ 32 /* Log-Gain Prediction Error CodeBook SiZe */
|
||||
#define LSPPORDER 8 /* LSP MA Predictor ORDER */
|
||||
#define LSPECBSZ1 128 /* codebook size of 1st-stage LSP VQ */
|
||||
#define SVD1 3 /* split VQ dimension 1 */
|
||||
#define LSPECBSZ21 32 /* codebook size of 2nd-stage LSP split VQ */
|
||||
#define SVD2 5 /* split VQ dimension 2 */
|
||||
#define LSPECBSZ22 32 /* codebook size of 2nd stage LSP split VQ */
|
||||
|
||||
#define NVPSF (FRSZ/VDIM)
|
||||
#define NVPSSF (SFRSZ/VDIM)
|
||||
|
||||
/* Packetloss Concealment */
|
||||
#define ScPLCGmin 0.1
|
||||
#define ScPLCGmax 0.9
|
||||
#define PePLCGmin 0.5
|
||||
#define PePLCGmax 0.9
|
||||
#define ScPLCG_b ((ScPLCGmin - ScPLCGmax)/(PePLCGmax - PePLCGmin))
|
||||
#define ScPLCG_a (ScPLCGmin - ScPLCG_b*PePLCGmax)
|
||||
#define HoldPLCG 8
|
||||
#define AttnPLCG 50
|
||||
#define AttnFacPLCG (1.0/(Float)AttnPLCG)
|
||||
|
||||
/* Pre-emphasis filter coefficients */
|
||||
#define PEAPFC 0.75
|
||||
#define PEAZFC 0.5
|
||||
|
||||
#define INVSFRSZ (1./(Float)SFRSZ)
|
||||
#define FECNSF 2 /* number of FEC subframes per frame */
|
||||
|
||||
#define Minlg -2.0 /* minimum log-gain */
|
||||
#define TMinlg 0.25 /* minimum linear gain */
|
||||
#define GPO 16 /* order of MA prediction */
|
||||
|
||||
/* Level Estimation */
|
||||
#define estl_alpha (8191.0/8192.0)
|
||||
#define estl_beta (1023.0/1024.0)
|
||||
#define estl_beta1 (1.0 - estl_beta)
|
||||
#define estl_a (511.0/512.0)
|
||||
#define estl_a1 (1 - estl_a)
|
||||
#define estl_TH 0.2
|
||||
|
||||
/* Log-Gain Limitation */
|
||||
#define LGLB -24 /* Log-Gain Lower Bound */
|
||||
#define GCLB -8 /* Log-Gain Change Lower Bound */
|
||||
#define NGB 18 /* Number of Gain Bins */
|
||||
#define NGCB 11 /* Number of Gain Change Bins */
|
||||
#define MinE -2.0
|
||||
|
||||
#define PFO 1 /* preemphasis filter order */
|
||||
|
||||
#define LTMOFF MAXPP1 /* Long-Term filter Memory OFFset */
|
||||
|
||||
/* Parameters related to the gain decoder trap */
|
||||
#define NCLGLIM_TRAPPED 50 /* 0.125 sec */
|
||||
#define LEVEL_CONVERGENCE_TIME 100 /* 0.25 sec */
|
||||
|
||||
/* front-end highpass filter */
|
||||
#define HPO 2 /* High-pass filter order */
|
||||
|
||||
/* LPC weighting filter */
|
||||
#define LTWFL 0.5
|
||||
|
||||
/* Minimum gain threshold */
|
||||
#define TMinE (SFRSZ*0.25)
|
||||
|
||||
/* coarse pitch search */
|
||||
#define cpp_Qvalue 3
|
||||
#define cpp_scale (1<<cpp_Qvalue)
|
||||
|
||||
/* ------ Decimation Parameters ----- */
|
||||
#define DECF 8 /* DECimation Factor for coarse pitch period search */
|
||||
#define FRSZD (FRSZ/DECF) /* FRame SiZe in DECF:1 lowband domain */
|
||||
#define MAXPPD (MAXPP/DECF) /* MAX Pitch in DECF:1, if MAXPP!=4n, ceil() */
|
||||
#define MINPPD ((int) (MINPP/DECF)) /* MINimum Pitch Period in DECF:1 */
|
||||
#define PWSZD (PWSZ/DECF) /* Pitch ana. Window SiZe in DECF:1 domain */
|
||||
#define DFO 4
|
||||
#define MAXPPD1 (MAXPPD + 1)
|
||||
#define LXD (MAXPPD1 + PWSZD)
|
||||
#define XDOFF (LXD - FRSZD)
|
||||
#define HMAXPPD (MAXPPD/2)
|
||||
#define M1 (MINPPD - 1)
|
||||
#define M2 MAXPPD1
|
||||
#define HDECF (DECF/2)
|
||||
#define INVDECF (1.0F/(float)(DECF)) /* INVerse of DECF (decimation factor) */
|
||||
|
||||
/* coarse pitch */
|
||||
#define MPTH4 0.3 /* value to use for MPTH[] with index >= 4 */
|
||||
#define DEVTH 0.25 /* pitch period DEViation THreshold */
|
||||
#define TH1 0.73 /* first threshold for cor*cor/energy */
|
||||
#define TH2 0.4 /* second threshold for cor*cor/energy */
|
||||
#define LPTH1 0.78 /* Last Pitch cor*cor/energy THreshold 1 */
|
||||
#define LPTH2 0.43 /* Last Pitch cor*cor/energy THreshold 2 */
|
||||
#define MPDTH 0.06 /* Multiple Pitch Deviation THreshold */
|
||||
#define SMDTH 0.095 /* Sub-Multiple pitch Deviation THreshold */
|
||||
#define SMDTH1 (1.0 - SMDTH)
|
||||
#define SMDTH2 (1.0 + SMDTH)
|
||||
#define MPR1 (1.0 - MPDTH) /* Multiple Pitch Range lower threshold */
|
||||
#define MPR2 (1.0 + MPDTH) /* Multiple Pitch Range upper threshold */
|
||||
#define MAX_NPEAKS 7
|
||||
|
||||
/* buffer offset and length */
|
||||
#define XOFF MAXPP1 /* offset for x() frame */
|
||||
#define LX (XOFF+FRSZ) /* Length of x() buffer */
|
||||
|
||||
#endif
|
|
@ -1,361 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* bv32_coarptch.c -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv32coarse_pitch.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bv32cnst.h"
|
||||
#include "utility.h"
|
||||
#include "bv32externs.h"
|
||||
|
||||
int bv32_coarsepitch(Float *xw,
|
||||
Float *xwdm,
|
||||
Float *dfm, /* (i/o) ellipse low pass filter memory */
|
||||
int cpplast) /* in the undecimated domain Q3 */
|
||||
{
|
||||
Float xwd[LXD];
|
||||
Float _cor[MAXPPD1 + 1];
|
||||
Float _cor2[MAXPPD1 + 1];
|
||||
Float _energy[MAXPPD1 + 1];
|
||||
Float *cor, *cor2, *energy;
|
||||
Float cor2i[MAX_NPEAKS], energyi[MAX_NPEAKS];
|
||||
Float tmp[DFO+FRSZ], threshold;
|
||||
Float *fp0, *fp1, *fp2, *fp3, s, t, a, b, c, deltae;
|
||||
Float cor2max, energymax, cor2m, energym, ci, eni;
|
||||
int cpp, maxdev, plag[MAX_NPEAKS], mplth; /* in the undecimated domain Q3 */
|
||||
int i, j, k, n, npeaks, imax, im, idx[HMAXPPD];
|
||||
int flag, mpflag;
|
||||
|
||||
cor = _cor + 1;
|
||||
cor2 = _cor2 + 1;
|
||||
energy = _energy + 1;
|
||||
|
||||
/* LOWPASS FILTER xw() TO 800 Hz; SHIFT & OUTPUT INTO xwd() */
|
||||
|
||||
/* load xwd[] buffer memory */
|
||||
Fcopy(xwd, xwdm, XDOFF);
|
||||
|
||||
/* copy memory to temp buffer */
|
||||
fp1 = tmp;
|
||||
fp2 = dfm;
|
||||
for (i = 0; i < DFO; i++)
|
||||
*fp1++ = *fp2++;
|
||||
|
||||
/* AP and AZ filtering and decimation */
|
||||
fp0 = xwd + XDOFF;
|
||||
fp3 = xw;
|
||||
for (i = 0; i < FRSZD; i++)
|
||||
{
|
||||
for (k = 0; k < DECF; k++)
|
||||
{
|
||||
t = *fp3++;
|
||||
fp2 = fp1 - 1;
|
||||
for (j = 0; j < DFO; j++)
|
||||
t -= bv32_adf[j + 1]*(*fp2--);
|
||||
*fp1++ = t;
|
||||
}
|
||||
fp2 = fp1 - 1;
|
||||
t = bv32_bdf[0]*(*fp2--);
|
||||
for (j = 0; j < DFO; j++)
|
||||
t += bv32_bdf[j + 1]*(*fp2--);
|
||||
*fp0++ = t;
|
||||
}
|
||||
|
||||
/* copy temp buffer to memory */
|
||||
fp1 -= DFO;
|
||||
for (i = 0; i < DFO; i++)
|
||||
dfm[i] = *fp1++;
|
||||
Fcopy(xwdm, xwd + FRSZD, XDOFF);
|
||||
|
||||
/* COMPUTE CORRELATION & ENERGY OF PREDICTION BASIS VECTOR */
|
||||
fp0 = xwd + MAXPPD1;
|
||||
fp1 = xwd + MAXPPD1 - M1;
|
||||
s = t = 0.0;
|
||||
for (i = 0; i < (LXD - MAXPPD1); i++)
|
||||
{
|
||||
s += (*fp1)*(*fp1);
|
||||
t += (*fp0++)*(*fp1++);
|
||||
}
|
||||
if (s < 1.e-10)
|
||||
{
|
||||
s = t = 0.0;
|
||||
}
|
||||
energy[M1 - 1] = s;
|
||||
cor[M1 - 1] = t;
|
||||
if (t > 0.0F)
|
||||
cor2[M1 - 1] = t*t;
|
||||
else
|
||||
cor2[M1 - 1] = -t*t;
|
||||
|
||||
|
||||
fp2 = xwd + LXD - M1 - 1;
|
||||
fp3 = xwd + MAXPPD1 - M1 - 1;
|
||||
|
||||
for (i = M1; i < M2; i++)
|
||||
{
|
||||
fp0 = xwd + MAXPPD1;
|
||||
fp1 = xwd + MAXPPD1 - i - 1;
|
||||
t = 0.0;
|
||||
for (j = 0; j < (LXD - MAXPPD1); j++)
|
||||
t += (*fp0++)*(*fp1++);
|
||||
s = s - (*fp2)*(*fp2) + (*fp3)*(*fp3);
|
||||
if (s < 1.e-10)
|
||||
{
|
||||
s = t = 0.0;
|
||||
}
|
||||
cor[i] = t;
|
||||
if (t > 0.0F)
|
||||
cor2[i] = t*t;
|
||||
else
|
||||
cor2[i] = -t*t;
|
||||
fp2--;
|
||||
fp3--;
|
||||
energy[i] = s;
|
||||
}
|
||||
|
||||
/* FIND POSITIVE COR*COR/ENERGY PEAKS */
|
||||
npeaks = 0;
|
||||
n = MINPPD-1;
|
||||
while ((npeaks < MAX_NPEAKS) && (n < MAXPPD))
|
||||
{
|
||||
if ((cor2[n]*energy[n - 1] > cor2[n - 1]*energy[n])
|
||||
&&
|
||||
(cor2[n]*energy[n + 1] > cor2[n + 1]*energy[n])
|
||||
&&
|
||||
(cor2[n] > 0))
|
||||
{
|
||||
idx[npeaks] = n;
|
||||
npeaks++;
|
||||
}
|
||||
n++;
|
||||
}
|
||||
|
||||
/* RETURN EARLY IF THERE IS NO PEAK OR ONLY ONE PEAK */
|
||||
if (npeaks == 0) /* if there are no positive peak, */
|
||||
return MINPPD*cpp_scale; /* return minimum pitch period */
|
||||
if (npeaks == 1) /* if there is exactly one peak, */
|
||||
return (idx[0] + 1)*cpp_scale; /* return the time lag for this peak */
|
||||
|
||||
/* IF PROGRAM PROCEEDS TO HERE, THERE ARE 2 OR MORE PEAKS */
|
||||
cor2max = -1e30;
|
||||
energymax = 1.0F;
|
||||
imax = 0;
|
||||
for (i = 0; i < npeaks; i++)
|
||||
{
|
||||
/* USE QUADRATIC INTERPOLATION TO FIND THE INTERPOLATED cor[] AND
|
||||
energy[] CORRESPONDING TO INTERPOLATED PEAK OF cor2[]/energy[] */
|
||||
/* first calculate coefficients of y(x)=ax^2+bx+c; */
|
||||
n = idx[i];
|
||||
a = 0.5F*(cor[n + 1] + cor[n - 1]) - cor[n];
|
||||
b = 0.5F*(cor[n + 1] - cor[n - 1]);
|
||||
c = cor[n];
|
||||
|
||||
/* INITIALIZE VARIABLES BEFORE SEARCHING FOR INTERPOLATED PEAK */
|
||||
im = 0;
|
||||
cor2m = cor2[n];
|
||||
energym = energy[n];
|
||||
eni = energy[n];
|
||||
|
||||
/* DERTERMINE WHICH SIDE THE INTERPOLATED PEAK FALLS IN, THEN
|
||||
DO THE SEARCH IN THE APPROPRIATE RANGE */
|
||||
if (cor2[n + 1]*energy[n - 1] > cor2[n - 1]*energy[n + 1]) /* if right side */
|
||||
{
|
||||
deltae=(energy[n + 1] - eni)*INVDECF; /*increment for linear interp.*/
|
||||
for (k = 0; k < HDECF; k++)
|
||||
{
|
||||
ci = a*bv32_x2[k] + b*bv32_x[k] + c; /* quadratically interpolated cor[] */
|
||||
eni += deltae; /* linearly interpolated energy[] */
|
||||
if (ci*ci*energym > cor2m*eni)
|
||||
{
|
||||
im = k + 1;
|
||||
cor2m = ci*ci;
|
||||
energym = eni;
|
||||
}
|
||||
}
|
||||
}
|
||||
else /* if interpolated peak is on the left side */
|
||||
{
|
||||
deltae = (energy[n-1] - eni)*INVDECF; /*increment for linear interp.*/
|
||||
for (k = 0; k < HDECF; k++)
|
||||
{
|
||||
ci = a*bv32_x2[k] - b*bv32_x[k] + c;
|
||||
eni += deltae;
|
||||
if (ci*ci*energym > cor2m*eni)
|
||||
{
|
||||
im = -k - 1;
|
||||
cor2m = ci*ci;
|
||||
energym = eni;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* SEARCH DONE; ASSIGN cor2[] AND energy[] CORRESPONDING TO
|
||||
INTERPOLATED PEAK */
|
||||
plag[i] = (idx[i] + 1)*cpp_scale + im; /* lag of interp. peak */
|
||||
cor2i[i] = cor2m; /* interpolated cor2[] of i-th interpolated peak */
|
||||
energyi[i] = energym; /* interpolated energy[] of i-th interpolated peak */
|
||||
|
||||
/* SEARCH FOR GLOBAL MAXIMUM OF INTERPOLATED cor2[]/energy[] peak */
|
||||
if (cor2m*energymax > cor2max*energym)
|
||||
{
|
||||
imax = i;
|
||||
cor2max = cor2m;
|
||||
energymax = energym;
|
||||
}
|
||||
}
|
||||
cpp = plag[imax]; /* first candidate for coarse pitch period */
|
||||
mplth = plag[npeaks - 1]; /* set mplth to the lag of last peak */
|
||||
|
||||
/* FIND THE LARGEST PEAK (IF THERE IS ANY) AROUND THE LAST PITCH */
|
||||
maxdev = (int) (DEVTH*cpplast); /* maximum deviation from last pitch */
|
||||
im = -1;
|
||||
cor2m = -1.0e30;
|
||||
energym = 1.0F;
|
||||
for (i = 0; i < npeaks; i++) /* loop thru the peaks before the largest peak */
|
||||
{
|
||||
if (abs(plag[i] - cpplast) <= maxdev)
|
||||
{
|
||||
if (cor2i[i]*energym > cor2m*energyi[i])
|
||||
{
|
||||
im = i;
|
||||
cor2m = cor2i[i];
|
||||
energym = energyi[i];
|
||||
}
|
||||
}
|
||||
} /* if there is no peaks around last pitch, then im is still -1 */
|
||||
|
||||
/* NOW SEE IF WE SHOULD PICK ANY ALTERNATICE PEAK */
|
||||
/* FIRST, SEARCH FIRST HALF OF PITCH RANGE, SEE IF ANY QUALIFIED PEAK
|
||||
HAS LARGE ENOUGH PEAKS AT EVERY MULTIPLE OF ITS LAG */
|
||||
i = 0;
|
||||
while (plag[i] < 0.5*mplth)
|
||||
{
|
||||
/* DETERMINE THE APPROPRIATE THRESHOLD FOR THIS PEAK */
|
||||
if (i != im) /* if not around last pitch, */
|
||||
{
|
||||
threshold = TH1; /* use a higher threshold */
|
||||
}
|
||||
else /* if around last pitch */
|
||||
{
|
||||
threshold = TH2; /* use a lower threshold */
|
||||
}
|
||||
|
||||
/* IF THRESHOLD EXCEEDED, TEST PEAKS AT MULTIPLES OF THIS LAG */
|
||||
if (cor2i[i]*energymax > threshold*cor2max*energyi[i])
|
||||
{
|
||||
flag = 1;
|
||||
j = i + 1;
|
||||
k = 0;
|
||||
s = 2.0F*plag[i]; /* initialize t to twice the current lag */
|
||||
while (s <= mplth) /* loop thru all multiple lag <= mplth */
|
||||
{
|
||||
mpflag = 0; /* initialize multiple pitch flag to 0 */
|
||||
a = MPR1*s; /* multiple pitch range lower bound */
|
||||
b = MPR2*s; /* multiple pitch range upper bound */
|
||||
while (j < npeaks) /* loop thru peaks with larger lags */
|
||||
{
|
||||
if (plag[j] > b) /* if range exceeded, */
|
||||
{
|
||||
break; /* break the innermost while loop */
|
||||
} /* if didn't break, then plag[j] <= b */
|
||||
if (plag[j] > a) /* if current peak lag within range, */
|
||||
{
|
||||
/* then check if peak value large enough */
|
||||
if (k < 4)
|
||||
{
|
||||
c = bv32_MPTH[k];
|
||||
}
|
||||
else
|
||||
{
|
||||
c = MPTH4;
|
||||
}
|
||||
if (cor2i[j]*energymax > c*cor2max*energyi[j])
|
||||
{
|
||||
mpflag = 1; /* if peak large enough, set mpflag, */
|
||||
break; /* and break the innermost while loop */
|
||||
}
|
||||
}
|
||||
j++;
|
||||
}
|
||||
/* if no qualified peak found at this multiple lag */
|
||||
if (mpflag == 0)
|
||||
{
|
||||
flag=0; /* disqualify the lag plag[i] */
|
||||
break; /* and break the while (s<=mplth) loop */
|
||||
}
|
||||
k++;
|
||||
s += plag[i]; /* update s to the next multiple pitch lag */
|
||||
}
|
||||
/* if there is a qualified peak at every multiple of plag[i], */
|
||||
if (flag == 1)
|
||||
return plag[i]; /* and return to calling function */
|
||||
}
|
||||
i++;
|
||||
if (i == npeaks)
|
||||
break; /* to avoid out of array bound error */
|
||||
}
|
||||
|
||||
/* IF PROGRAM PROCEEDS TO HERE, NONE OF THE PEAKS WITH LAGS < 0.5*mplth
|
||||
QUALIFIES AS THE FINAL PITCH. IN THIS CASE, CHECK IF
|
||||
THERE IS ANY PEAK LARGE ENOUGH AROUND LAST PITCH. IF SO, USE ITS
|
||||
LAG AS THE FINAL PITCH. */
|
||||
if (im != -1) /* if there is at least one peak around last pitch */
|
||||
{
|
||||
if (im == imax) /* if this peak is also the global maximum, */
|
||||
return cpp; /* return first pitch candidate at global max */
|
||||
if (im < imax) /* if lag of this peak < lag of global max, */
|
||||
{
|
||||
if (cor2m*energymax > LPTH2*cor2max*energym)
|
||||
{
|
||||
if (plag[im] > HMAXPPD*cpp_scale)
|
||||
return plag[im];
|
||||
for (k = 2; k <= 5; k++) /* check if current candidate pitch */
|
||||
{
|
||||
s = plag[imax]/(float)(k); /* is a sub-multiple of */
|
||||
a = SMDTH1*s; /* the time lag of */
|
||||
b = SMDTH2*s; /* the global maximum peak */
|
||||
if (plag[im] > a && plag[im] < b) /* if so, */
|
||||
return plag[im]; /* and return as pitch */
|
||||
}
|
||||
}
|
||||
}
|
||||
else /* if lag of this peak > lag of global max, */
|
||||
{
|
||||
if (cor2m*energymax > LPTH1*cor2max*energym)
|
||||
return plag[im]; /* accept its lag */
|
||||
}
|
||||
}
|
||||
|
||||
/* IF PROGRAM PROCEEDS TO HERE, WE HAVE NO CHOICE BUT TO ACCEPT THE
|
||||
LAG OF THE GLOBAL MAXIMUM */
|
||||
return cpp;
|
||||
}
|
|
@ -1,194 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* decoder.c -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv32decoder.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bv32cnst.h"
|
||||
#include "utility.h"
|
||||
#include "bvcommon.h"
|
||||
#include "bv32externs.h"
|
||||
#include "bv32strct.h"
|
||||
#include "bitpack32.h"
|
||||
#include "broadvoice/broadvoice.h"
|
||||
|
||||
BV_DECLARE(bv32_decode_state_t *) bv32_decode_init(bv32_decode_state_t *s)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (s == NULL)
|
||||
{
|
||||
if ((s = (bv32_decode_state_t *) malloc(sizeof(*s))) == NULL)
|
||||
return NULL;
|
||||
}
|
||||
for (i = 0; i < LPCO; i++)
|
||||
s->lsplast[i] = (Float)(i + 1)/(Float)(LPCO + 1);
|
||||
Fzero(s->stsym, LPCO);
|
||||
Fzero(s->ltsym, LTMOFF);
|
||||
Fzero(s->lgpm, LGPORDER);
|
||||
Fzero(s->lsppm, LPCO*LSPPORDER);
|
||||
Fzero(s->dezfm, PFO);
|
||||
Fzero(s->depfm, PFO);
|
||||
s->cfecount = 0;
|
||||
s->idum = 0;
|
||||
s->scplcg = 1.0;
|
||||
s->per = 0;
|
||||
s->E = 0.0;
|
||||
for (i = 0; i < LPCO; i++)
|
||||
s->atplc[i + 1] = 0.0;
|
||||
s->pp_last = 100;
|
||||
s->prevlg[0] = MinE;
|
||||
s->prevlg[1] = MinE;
|
||||
s->lgq_last = MinE;
|
||||
s->lmax = -100.0;
|
||||
s->lmin = 100.0;
|
||||
s->lmean = 8.0;
|
||||
s->x1 = 13.5;
|
||||
s->level = 13.5;
|
||||
s->nclglim = 0;
|
||||
s->lctimer = 0;
|
||||
return s;
|
||||
}
|
||||
|
||||
BV_DECLARE(int) bv32_decode(bv32_decode_state_t *ds,
|
||||
int16_t amp[],
|
||||
const uint8_t *in,
|
||||
int len)
|
||||
{
|
||||
Float xq[FRSZ];
|
||||
Float ltsym[LTMOFF + FRSZ];
|
||||
Float a[LPCO + 1];
|
||||
Float lspq[LPCO];
|
||||
Float bq[3];
|
||||
Float gainq[NSF];
|
||||
Float lgq[NSF];
|
||||
Float E;
|
||||
int16_t pp;
|
||||
int16_t i;
|
||||
Float bss;
|
||||
struct BV32_Bit_Stream bs;
|
||||
int ii;
|
||||
int outlen;
|
||||
|
||||
outlen = 0;
|
||||
for (ii = 0; ii < len; ii += 20)
|
||||
{
|
||||
bv32_bitunpack(&in[ii], &bs);
|
||||
|
||||
/* Reset frame erasure counter */
|
||||
ds->cfecount = 0;
|
||||
|
||||
/* Decode spectral information */
|
||||
bv32_lspdec(lspq, bs.lspidx, ds->lsppm, ds->lsplast);
|
||||
lsp2a(lspq, a);
|
||||
|
||||
/* Decode pitch period & 3 pitch predictor taps */
|
||||
pp = (bs.ppidx + MINPP);
|
||||
bv32_pp3dec(bs.bqidx, bq);
|
||||
|
||||
/* Decode excitation gain */
|
||||
for (i = 0; i < NSF; i++)
|
||||
{
|
||||
gainq[i] = bv32_gaindec(lgq + i,
|
||||
bs.gidx[i],
|
||||
ds->lgpm,
|
||||
ds->prevlg,
|
||||
ds->level,
|
||||
&ds->nclglim,
|
||||
ds->lctimer);
|
||||
|
||||
if (ds->lctimer > 0)
|
||||
ds->lctimer = ds->lctimer - 1;
|
||||
if (ds->nclglim == NCLGLIM_TRAPPED)
|
||||
ds->lctimer = LEVEL_CONVERGENCE_TIME;
|
||||
|
||||
/* Level estimation */
|
||||
bv32_estlevel(ds->prevlg[0], &ds->level, &ds->lmax, &ds->lmin, &ds->lmean, &ds->x1);
|
||||
}
|
||||
|
||||
/* Copy state memory ltsym[] to local buffer */
|
||||
Fcopy(ltsym, ds->ltsym, LTMOFF);
|
||||
|
||||
/* Decode the excitation signal */
|
||||
bv32_excdec_w_LT_synth(ltsym, bs.qvidx, gainq, bq, pp, &E);
|
||||
|
||||
ds->E = E;
|
||||
|
||||
/* LPC synthesis filtering of excitation */
|
||||
apfilter(a, LPCO, ltsym + LTMOFF, xq, FRSZ, ds->stsym, 1);
|
||||
|
||||
/* Update pitch period of last frame */
|
||||
ds->pp_last = pp;
|
||||
|
||||
/* Update signal memory */
|
||||
Fcopy(ds->ltsym, ltsym + FRSZ, LTMOFF);
|
||||
Fcopy(ds->bq_last, bq, 3);
|
||||
|
||||
/* Update average quantized log-gain */
|
||||
ds->lgq_last = 0.5*(lgq[0] + lgq[1]);
|
||||
|
||||
/* De-emphasis filtering */
|
||||
azfilter(bv32_a_pre, PFO, xq, xq, FRSZ, ds->dezfm, 1);
|
||||
apfilter(bv32_b_pre, PFO, xq, xq, FRSZ, ds->depfm, 1);
|
||||
|
||||
F2s(&[outlen], xq, FRSZ);
|
||||
Fcopy(ds->lsplast, lspq, LPCO);
|
||||
|
||||
Fcopy(ds->atplc, a, LPCO + 1);
|
||||
|
||||
bss = bq[0] + bq[1] + bq[2];
|
||||
if (bss > 1.0)
|
||||
bss = 1.0;
|
||||
else if (bss < 0.0)
|
||||
bss = 0.0;
|
||||
ds->per = 0.5*ds->per + 0.5*bss;
|
||||
outlen += FRSZ;
|
||||
}
|
||||
return outlen;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
BV_DECLARE(int) bv32_decode_release(bv32_decode_state_t *s)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
BV_DECLARE(int) bv32_decode_free(bv32_decode_state_t *s)
|
||||
{
|
||||
free(s);
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
/*- End of file ------------------------------------------------------------*/
|
|
@ -1,230 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* encoder.c -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bv32cnst.h"
|
||||
#include "utility.h"
|
||||
#include "bvcommon.h"
|
||||
#include "bv32externs.h"
|
||||
#include "bv32strct.h"
|
||||
#include "bitpack32.h"
|
||||
#include "broadvoice/broadvoice.h"
|
||||
|
||||
BV_DECLARE(bv32_encode_state_t *) bv32_encode_init(bv32_encode_state_t *s)
|
||||
{
|
||||
int k;
|
||||
|
||||
if (s == NULL)
|
||||
{
|
||||
if ((s = (bv32_encode_state_t *) malloc(sizeof(*s))) == NULL)
|
||||
return NULL;
|
||||
}
|
||||
Fzero(s->lgpm, LGPORDER);
|
||||
s->allast[0] = 1.0;
|
||||
Fzero(s->allast + 1, LPCO);
|
||||
for (k = 0; k < LPCO; k++)
|
||||
s->lsplast[k] = (Float) (k + 1)/(Float)(LPCO + 1);
|
||||
Fzero(s->lsppm, LPCO*LSPPORDER);
|
||||
Fzero(s->x, XOFF);
|
||||
Fzero(s->xwd, XDOFF);
|
||||
Fzero(s->dq, XOFF);
|
||||
Fzero(s->stpem, LPCO);
|
||||
Fzero(s->stwpm, LPCO);
|
||||
Fzero(s->dfm, DFO);
|
||||
Fzero(s->stnfm, LPCO);
|
||||
Fzero(s->stsym, LPCO);
|
||||
Fzero(s->ltsym, MAXPP1 + FRSZ);
|
||||
Fzero(s->ltnfm, MAXPP1 + FRSZ);
|
||||
s->cpplast = 12*cpp_scale;
|
||||
Fzero(s->hpfzm,HPO);
|
||||
Fzero(s->hpfpm,HPO);
|
||||
s->prevlg[0] = MinE;
|
||||
s->prevlg[1] = MinE;
|
||||
s->lmax = -100.0;
|
||||
s->lmin = 100.0;
|
||||
s->lmean = 8.0;
|
||||
s->x1 = 13.5;
|
||||
s->level = 13.5;
|
||||
return s;
|
||||
}
|
||||
|
||||
BV_DECLARE(int) bv32_encode(bv32_encode_state_t *cs,
|
||||
uint8_t *out,
|
||||
const int16_t amp[],
|
||||
int len)
|
||||
{
|
||||
Float x[LX];
|
||||
Float dq[LX];
|
||||
Float xw[FRSZ];
|
||||
Float r[LPCO + 1];
|
||||
Float a[LPCO + 1];
|
||||
Float aw[LPCO + 1];
|
||||
Float lsp[LPCO];
|
||||
Float lspq[LPCO];
|
||||
Float cbs[VDIM*CBSZ];
|
||||
Float qv[SFRSZ];
|
||||
Float bq[3];
|
||||
Float beta;
|
||||
Float gainq[2];
|
||||
Float lg;
|
||||
Float e;
|
||||
Float ee;
|
||||
Float ppt;
|
||||
int pp;
|
||||
int cpp;
|
||||
int i;
|
||||
int issf;
|
||||
Float *fp0;
|
||||
Float *fp1;
|
||||
struct BV32_Bit_Stream bs;
|
||||
int ii;
|
||||
int outlen;
|
||||
|
||||
outlen = 0;
|
||||
for (ii = 0; ii < len; ii += FRSZ)
|
||||
{
|
||||
/* Copy state memory to local memory buffers */
|
||||
Fcopy(x, cs->x, XOFF);
|
||||
for (i = 0; i < FRSZ; i++)
|
||||
x[XOFF + i] = (Float) amp[ii + i];
|
||||
|
||||
/* High pass filtering & pre-emphasis filtering */
|
||||
azfilter(bv32_hpfb, HPO, x + XOFF, x + XOFF, FRSZ, cs->hpfzm, 1);
|
||||
apfilter(bv32_hpfa, HPO, x + XOFF, x + XOFF, FRSZ, cs->hpfpm, 1);
|
||||
|
||||
/* Copy to coder state */
|
||||
Fcopy(cs->x, x + FRSZ, XOFF);
|
||||
|
||||
/* Perform lpc analysis with asymmetrical window */
|
||||
Autocor(r, x + LX - WINSZ, bv32_winl, WINSZ, LPCO); /* get autocorrelation lags */
|
||||
|
||||
for (i = 0; i <= LPCO; i++)
|
||||
r[i] *= bv32_sstwin[i]; /* apply spectral smoothing */
|
||||
Levinson(r, a, cs->allast, LPCO); /* Levinson-Durbin recursion */
|
||||
for (i = 0; i <= LPCO; i++)
|
||||
a[i] *= bwel[i];
|
||||
|
||||
a2lsp(a, lsp, cs->lsplast);
|
||||
|
||||
bv32_lspquan(lspq, bs.lspidx, lsp, cs->lsppm);
|
||||
|
||||
lsp2a(lspq, a);
|
||||
|
||||
/* Calculate LPC prediction residual */
|
||||
Fcopy(dq, cs->dq, XOFF); /* copy dq() state to buffer */
|
||||
azfilter(a, LPCO, x + XOFF, dq + XOFF, FRSZ, cs->stpem, 1);
|
||||
|
||||
/* Use weighted version of LPC filter as noise feedback filter */
|
||||
for (i = 0; i <= LPCO; i++)
|
||||
aw[i] = STWAL[i]*a[i];
|
||||
|
||||
/* Get perceptually weighted version of speech */
|
||||
apfilter(aw, LPCO, dq + XOFF, xw, FRSZ, cs->stwpm, 1);
|
||||
|
||||
/* Get the coarse version of pitch period using 8:1 decimation */
|
||||
cpp = bv32_coarsepitch(xw, cs->xwd, cs->dfm, cs->cpplast);
|
||||
cs->cpplast = cpp;
|
||||
|
||||
/* Refine the pitch period in the neighborhood of coarse pitch period
|
||||
also calculate the pitch predictor tap for single-tap predictor */
|
||||
pp = bv32_refinepitch(dq, cpp, &ppt);
|
||||
bs.ppidx = (int16_t) (pp - MINPP);
|
||||
|
||||
/* vq 3 pitch predictor taps with minimum residual energy */
|
||||
bs.bqidx = (int16_t) bv32_pitchtapquan(dq, pp, bq);
|
||||
|
||||
/* get coefficients for long-term noise feedback filter */
|
||||
if (ppt > 1.0)
|
||||
beta = LTWFL;
|
||||
else if (ppt < 0.0)
|
||||
beta = 0.0;
|
||||
else
|
||||
beta = LTWFL*ppt;
|
||||
|
||||
/* Loop over excitation sub-frames */
|
||||
for (issf = 0; issf < NSF; issf++)
|
||||
{
|
||||
/* Calculate pitch prediction residual */
|
||||
fp0 = dq + XOFF + issf*SFRSZ;
|
||||
fp1 = dq + XOFF + issf*SFRSZ - (pp - 2) - 1;
|
||||
ee = 0.0;
|
||||
for (i = 0; i < SFRSZ; i++)
|
||||
{
|
||||
e = *fp0++ - bq[0]*fp1[0] - bq[1] * fp1[-1] - bq[2] * fp1[-2];
|
||||
fp1++;
|
||||
ee += e*e;
|
||||
}
|
||||
|
||||
/* Log-gain quantization within each sub-frame */
|
||||
lg = (ee < TMinE) ? MinE : log(ee/SFRSZ)/log(2.0);
|
||||
bs.gidx[issf] = (int16_t) bv32_gainquan(gainq + issf, lg, cs->lgpm, cs->prevlg, cs->level);
|
||||
|
||||
/* Level Estimation */
|
||||
bv32_estlevel(cs->prevlg[0], &cs->level, &cs->lmax, &cs->lmin, &cs->lmean, &cs->x1);
|
||||
|
||||
/* Scale the excitation codebook */
|
||||
for (i = 0; i < (VDIM*CBSZ); i++)
|
||||
cbs[i] = gainq[issf]*bv32_cccb[i];
|
||||
|
||||
/* Perform noise feedback coding of the excitation signal */
|
||||
bv32_excquan(qv, bs.qvidx + issf*NVPSSF, dq + XOFF + issf*SFRSZ, aw, bq, beta, cs->ltsym, cs->ltnfm, cs->stnfm, cbs, pp);
|
||||
|
||||
/* Update quantized short-term prediction residual buffer */
|
||||
Fcopy(dq + XOFF + issf*SFRSZ, qv, SFRSZ);
|
||||
}
|
||||
|
||||
/* update state memory */
|
||||
Fcopy(cs->dq, dq + FRSZ, XOFF);
|
||||
Fcopy(cs->lsplast, lspq, LPCO);
|
||||
i = bv32_bitpack(out, &bs);
|
||||
out += i;
|
||||
outlen += i;
|
||||
}
|
||||
return outlen;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
BV_DECLARE(int) bv32_encode_release(bv32_encode_state_t *s)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
BV_DECLARE(int) bv32_encode_free(bv32_encode_state_t *s)
|
||||
{
|
||||
free(s);
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
/*- End of file ------------------------------------------------------------*/
|
|
@ -1,88 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* excdec.c - Excitation signal decoding including long-term synthesis.
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv32excdec.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bv32externs.h"
|
||||
|
||||
void bv32_excdec_w_LT_synth(Float *ltsymd, /* long-term synthesis filter memory at decoder*/
|
||||
int16_t *idx, /* excitation codebook index array for current subframe */
|
||||
Float *gainq, /* quantized linear gains for sub-subframes */
|
||||
Float *b, /* coefficient of 3-tap pitch predictor */
|
||||
int16_t pp, /* pitch period (# of 8 kHz samples) */
|
||||
Float *EE)
|
||||
{
|
||||
Float a0;
|
||||
Float *fp1;
|
||||
Float *fp2;
|
||||
const Float *fp3;
|
||||
Float gain;
|
||||
int i;
|
||||
int m;
|
||||
int n;
|
||||
int id;
|
||||
int16_t *ip;
|
||||
Float E;
|
||||
Float t;
|
||||
|
||||
ip = idx;
|
||||
fp1 = <symd[LTMOFF]; /* fp1 points to 1st sample of current subframe */
|
||||
fp2 = <symd[LTMOFF - pp + 1];
|
||||
for (i = 0; i < NSF; i++) /* loop through sub-subframes */
|
||||
{
|
||||
E = 0.0;
|
||||
for (m = 0; m < SFRSZ; m += VDIM) /* loop thru vectors in sub-subframe */
|
||||
{
|
||||
id = *ip++; /* get codebook index of current vector */
|
||||
if (id < CBSZ)
|
||||
{
|
||||
gain = gainq[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
gain = -gainq[i];
|
||||
id -= CBSZ;
|
||||
}
|
||||
fp3 = &bv32_cccb[id*VDIM];
|
||||
for (n = 0; n < VDIM; n++)
|
||||
{
|
||||
a0 = b[0] * *fp2--;
|
||||
a0 += b[1] * *fp2--;
|
||||
a0 += b[2] * *fp2;/* a0=pitch predicted value of LT syn filt */
|
||||
t = *fp3++ * gain;
|
||||
E += t*t;
|
||||
*fp1++ = a0 + t; /* add scale codevector to a0 */
|
||||
fp2 = &fp2[3]; /* prepare fp2 for filtering next sample */
|
||||
}
|
||||
}
|
||||
}
|
||||
*EE = E;
|
||||
}
|
|
@ -1,245 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* excquan.c -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
Vector Quantizer for 2-Stage Noise Feedback Coding
|
||||
with long-term predictive noise feedback coding embedded
|
||||
inside the short-term predictive noise feedback coding loop.
|
||||
|
||||
Note that the Noise Feedback Coding of the excitation signal is implemented
|
||||
using the Zero-State Responsse and Zero-input Response decomposition as
|
||||
described in: J.-H. Chen, "Novel Codec Structures for Noise Feedback
|
||||
Coding of Speech," Proc. ICASSP, 2006.
|
||||
******************************************************************************/
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bv32cnst.h"
|
||||
#include "bvcommon.h"
|
||||
#include "bv32externs.h"
|
||||
|
||||
void bv32_excquan(Float *qv, /* output quantized excitation signal vector */
|
||||
int16_t *idx, /* quantizer codebook index for uq[] vector */
|
||||
Float *d, /* input prediction residual signal vector */
|
||||
Float *h, /* noise feedback filter coefficient array */
|
||||
Float *b, /* coefficient of 3-tap pitch predictor */
|
||||
Float beta, /* coefficient of 1-tap LT noise feedback filter */
|
||||
Float *ltsym, /* long-term synthesis filter memory */
|
||||
Float *ltnfm, /* long-term noise feedback filter memory */
|
||||
Float *stnfm, /* short-term noise feedback filter memory */
|
||||
Float *cb, /* scalar quantizer codebook */
|
||||
int pp) /* pitch period (# of 8 kHz samples) */
|
||||
{
|
||||
Float qzir[VDIM];
|
||||
Float zbuf[VDIM];
|
||||
Float buf[LPCO + SFRSZ]; /* buffer for filter memory & signal */
|
||||
Float a0;
|
||||
Float a1;
|
||||
Float *fp1;
|
||||
Float *fp2;
|
||||
Float *fp3;
|
||||
Float *fp4;
|
||||
Float sign = 1.0;
|
||||
Float ltfv[VDIM];
|
||||
Float ppv[VDIM];
|
||||
Float qzsr[VDIM*CBSZ];
|
||||
int i;
|
||||
int j;
|
||||
int m;
|
||||
int n;
|
||||
int jmin;
|
||||
int iv;
|
||||
Float E;
|
||||
Float Emin;
|
||||
Float e;
|
||||
|
||||
/* COPY FILTER MEMORY TO BEGINNING PART OF TEMPORARY BUFFER */
|
||||
fp1 = &stnfm[LPCO - 1];
|
||||
for (i = 0; i < LPCO; i++)
|
||||
buf[i] = *fp1--; /* this buffer is used to avoid memory shifts */
|
||||
|
||||
/* COMPUTE CODEBOOK ZERO-STATE RESPONSE */
|
||||
fp2 = cb;
|
||||
fp3 = qzsr;
|
||||
for (j = 0; j < CBSZ; j++)
|
||||
{
|
||||
*fp3 = *fp2++; /* no multiply-add needed for 1st ZSR vector element*/
|
||||
for (n = 1; n < VDIM; n++) /* loop from 2nd to last vector element */
|
||||
{
|
||||
/* PERFORM MULTIPLY-ADDS ALONG THE DELAY LINE OF FILTER */
|
||||
fp1 = &h[n];
|
||||
fp4 = fp3; /* fp4 --> first element of current ZSR vector */
|
||||
a0 = *fp2++; /* initialize a0 to codebook element */
|
||||
for (i = 0; i < n; i++)
|
||||
a0 -= *fp4++ * *fp1--;
|
||||
*fp4 = a0; /* update short-term noise feedback filter memory */
|
||||
}
|
||||
fp3 += VDIM; /* fp3 --> 1st element of next ZSR vector */
|
||||
}
|
||||
|
||||
/* LOOP THROUGH EVERY VECTOR OF THE CURRENT SUBFRAME */
|
||||
iv = 0; /* iv = index of the current vector */
|
||||
for (m = 0; m < SFRSZ; m += VDIM)
|
||||
{
|
||||
/* COMPUTE PITCH-PREDICTED VECTOR, WHICH SHOULD BE INDEPENDENT OF THE
|
||||
RESIDUAL VQ CODEVECTORS BEING TRIED IF VDIM < MIN. PITCH PERIOD */
|
||||
fp2 = ltfv;
|
||||
fp3 = ppv;
|
||||
for (n = m; n < m + VDIM; n++)
|
||||
{
|
||||
fp1 = <sym[MAXPP1 + n - pp + 1];
|
||||
a1 = b[0] * *fp1--;
|
||||
a1 += b[1] * *fp1--;
|
||||
a1 += b[2] * *fp1--;/* a1=pitch predicted vector of LT syn filt */
|
||||
*fp3++ = a1; /* write result to ppv[] vector */
|
||||
|
||||
*fp2++ = a1 + beta*ltnfm[MAXPP1 + n - pp];
|
||||
}
|
||||
|
||||
/* COMPUTE ZERO-INPUT RESPONSE */
|
||||
fp2 = ppv;
|
||||
fp4 = ltfv;
|
||||
fp3 = qzir;
|
||||
for (n = m; n < m + VDIM; n++)
|
||||
{
|
||||
/* PERFORM MULTIPLY-ADDS ALONG THE DELAY LINE OF FILTER */
|
||||
fp1 = &buf[n];
|
||||
a0 = d[n];
|
||||
for (i = LPCO; i > 0; i--)
|
||||
a0 -= *fp1++ * h[i];
|
||||
|
||||
/* a0 NOW CONTAINS v[n]; SUBTRACT THE SUM OF THE TWO LONG_TERM
|
||||
FILTERS TO GET THE ZERO-INPUT RESPONSE */
|
||||
*fp3++ = a0 - *fp4++; /* q[n] = u[n] during ZIR computation */
|
||||
|
||||
/* UPDATE SHORT-TERM NOISE FEEDBACK FILTER MEMORY */
|
||||
a0 -= *fp2++; /* a0 now contains qs[n] */
|
||||
*fp1 = a0; /* update short-term noise feedback filter memory */
|
||||
}
|
||||
|
||||
/* LOOP THROUGH EVERY CODEVECTOR OF THE RESIDUAL VQ CODEBOOK */
|
||||
/* AND FIND THE ONE THAT MINIMIZES THE ENERGY OF q[n] */
|
||||
|
||||
Emin = 1.0e30;
|
||||
fp4 = qzsr;
|
||||
jmin = 0;
|
||||
for (j = 0; j < CBSZ; j++)
|
||||
{
|
||||
/* Try positive sign */
|
||||
fp2 = qzir;
|
||||
E = 0.0;
|
||||
for (n = 0; n < VDIM; n++)
|
||||
{
|
||||
e = *fp2++ - *fp4++; // sign impacted by negated ZSR
|
||||
E += e*e;
|
||||
}
|
||||
if (E < Emin)
|
||||
{
|
||||
jmin = j;
|
||||
Emin = E;
|
||||
sign = +1.0F;
|
||||
}
|
||||
/* Try negative sign */
|
||||
fp4 -= VDIM;
|
||||
fp2 = qzir;
|
||||
E = 0.0;
|
||||
for (n = 0; n < VDIM; n++)
|
||||
{
|
||||
e = *fp2++ + *fp4++; // sign impacted by negated ZSR
|
||||
E += e*e;
|
||||
}
|
||||
if (E < Emin)
|
||||
{
|
||||
jmin = j;
|
||||
Emin = E;
|
||||
sign = -1.0F;
|
||||
}
|
||||
}
|
||||
|
||||
/* THE BEST CODEVECTOR HAS BEEN FOUND; ASSIGN VQ CODEBOOK INDEX */
|
||||
if (sign == 1.0F)
|
||||
idx[iv++] = (int16_t) jmin;
|
||||
else
|
||||
idx[iv++] = (int16_t) (jmin + CBSZ); /* MSB of index is sign bit */
|
||||
|
||||
/* BORROW zbuf[] TO STORE FINAL VQ OUTPUT VECTOR WITH CORRECT SIGN */
|
||||
fp3 = &cb[jmin*VDIM]; /* fp3 points to start of best codevector */
|
||||
for (n = 0; n < VDIM; n++)
|
||||
zbuf[n] = sign * *fp3++;
|
||||
|
||||
/* UPDATE FILTER MEMORY */
|
||||
fp2 = ppv; /* fp2 points to start of pitch-predicted vector */
|
||||
fp3 = zbuf; /* fp3 points to start of final VQ output vector */
|
||||
fp4 = ltfv; /* fp4 points to long-term filtered vector */
|
||||
|
||||
/* LOOP THROUGH EVERY ELEMENT OF THE CURRENT VECTOR */
|
||||
for (n = m; n < m + VDIM; n++)
|
||||
{
|
||||
/* PERFORM MULTIPLY-ADDS ALONG THE DELAY LINE OF FILTER */
|
||||
fp1 = &buf[n];
|
||||
a0 = d[n];
|
||||
for (i = LPCO; i > 0; i--)
|
||||
a0 -= *fp1++ * h[i];
|
||||
|
||||
/* COMPUTE VQ INPUT SIGNAL u[n] */
|
||||
a1 = a0 - *fp4++; /* a1 now contains u[n] */
|
||||
|
||||
/* COMPUTE VQ ERROR q[n] */
|
||||
a1 -= *fp3; /* a1 now contains VQ quantization error q[n] */
|
||||
|
||||
/* UPDATE LONG-TERM NOISE FEEDBACK FILTER MEMORY */
|
||||
ltnfm[MAXPP1 + n] = a1;
|
||||
|
||||
/* CALCULATE QUANTIZED LPC EXCITATION VECTOR qv[n] */
|
||||
qv[n] = (*fp3++ + *fp2++);
|
||||
|
||||
/* UPDATE LONG-TERM PREDICTOR MEMORY */
|
||||
ltsym[MAXPP1 + n] = qv[n];
|
||||
|
||||
/* COMPUTE ERROR BETWEEN v[n] AND qv[n] */
|
||||
a0 -= qv[n]; /* a0 now contains u[n] - qv[n] = qs[n] */
|
||||
|
||||
/* UPDATE SHORT-TERM NOISE FEEDBACK FILTER MEMORY */
|
||||
*fp1 = a0;
|
||||
}
|
||||
}
|
||||
|
||||
/* UPDATE NOISE FEEDBACK FILTER MEMORY AFTER FILTERING CURRENT SUBFRAME */
|
||||
for (i = 0; i < LPCO; i++)
|
||||
stnfm[i] = *fp1--;
|
||||
|
||||
/* UPDATE LONG-TERM PREDICTOR MEMORY AFTER PROCESSING CURRENT SUBFRAME */
|
||||
fp2 = <nfm[SFRSZ];
|
||||
fp3 = <sym[SFRSZ];
|
||||
for (i = 0; i < MAXPP1; i++)
|
||||
{
|
||||
ltnfm[i] = fp2[i];
|
||||
ltsym[i] = fp3[i];
|
||||
}
|
||||
}
|
|
@ -1,144 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* bv32externs.h -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv32externs.h,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bv32cnst.h"
|
||||
#include "bvcommon.h"
|
||||
|
||||
/* Pointers */
|
||||
extern const Float bv32_winl[];
|
||||
extern const Float bv32_sstwin[];
|
||||
extern const int bv32_idxord[];
|
||||
extern const Float bv32_hpfa[];
|
||||
extern const Float bv32_hpfb[];
|
||||
extern const Float bv32_adf[];
|
||||
extern const Float bv32_bdf[];
|
||||
extern const Float bv32_x[];
|
||||
extern const Float bv32_x2[];
|
||||
extern Float bv32_invk[];
|
||||
extern const Float bv32_MPTH[];
|
||||
|
||||
|
||||
/* LSP Quantization */
|
||||
extern const Float bv32_lspecb1[LSPECBSZ1*LPCO];
|
||||
extern const Float bv32_lspecb21[LSPECBSZ21*SVD1];
|
||||
extern const Float bv32_lspecb22[LSPECBSZ22*SVD2];
|
||||
extern const Float bv32_lspmean[LPCO];
|
||||
extern const Float bv32_lspp[LSPPORDER*LPCO];
|
||||
|
||||
/* Pitch Predictor Codebook */
|
||||
extern const Float bv32_pp9cb[];
|
||||
|
||||
/* Log-Gain Quantization */
|
||||
extern const Float bv32_lgpecb[LGPECBSZ];
|
||||
extern const Float bv32_lgp[LGPORDER];
|
||||
extern const Float bv32_lgmean;
|
||||
|
||||
/* Log-Gain Limitation */
|
||||
extern const Float bv32_lgclimit[];
|
||||
|
||||
/* Excitation Codebook */
|
||||
extern const Float bv32_cccb[CBSZ*VDIM];
|
||||
|
||||
extern const Float bv32_lgpecb_nh[];
|
||||
extern const Float bv32_a_pre[];
|
||||
extern const Float bv32_b_pre[];
|
||||
|
||||
/* Function Prototypes */
|
||||
|
||||
extern Float bv32_estlevel(Float lg,
|
||||
Float *level,
|
||||
Float *lmax,
|
||||
Float *lmin,
|
||||
Float *lmean,
|
||||
Float *x1);
|
||||
|
||||
extern void bv32_excdec_w_LT_synth(Float *ltsymd, /* long-term synthesis filter memory at decoder*/
|
||||
int16_t *idx, /* excitation codebook index array for current subframe */
|
||||
Float *gainq, /* quantized linear gains for sub-subframes */
|
||||
Float *b, /* coefficient of 3-tap pitch predictor */
|
||||
int16_t pp, /* pitch period (# of 8 kHz samples) */
|
||||
Float *EE);
|
||||
|
||||
extern Float bv32_gaindec(Float *lgq,
|
||||
int16_t gidx,
|
||||
Float *lgpm,
|
||||
Float *prevlg,
|
||||
Float level,
|
||||
int16_t *nclglim,
|
||||
int16_t lctimer);
|
||||
|
||||
extern void bv32_gainplc(Float E,
|
||||
Float *lgeqm,
|
||||
Float *lgqm);
|
||||
|
||||
extern void bv32_lspdec(Float *lspq,
|
||||
int16_t *lspidx,
|
||||
Float *lsppm,
|
||||
Float *lspq_last);
|
||||
|
||||
extern void bv32_lspplc(Float *lspq,
|
||||
Float *lsppm);
|
||||
|
||||
extern int bv32_coarsepitch(Float *xw,
|
||||
Float *xwd,
|
||||
Float *dfm,
|
||||
int cpplast);
|
||||
|
||||
|
||||
extern int bv32_refinepitch(Float *x,
|
||||
int cpp,
|
||||
Float *ppt);
|
||||
|
||||
extern int bv32_pitchtapquan(Float *x,
|
||||
int pp,
|
||||
Float *b);
|
||||
|
||||
extern void bv32_excquan(
|
||||
Float *qv, /* output quantized excitation signal vector */
|
||||
int16_t *idx, /* quantizer codebook index for uq[] vector */
|
||||
Float *d, /* input prediction residual signal vector */
|
||||
Float *h, /* noise feedback filter coefficient array */
|
||||
Float *b, /* coefficient of 3-tap pitch predictor */
|
||||
Float beta, /* coefficient of weighted 3-tap pitch predictor */
|
||||
Float *ltsym, /* long-term synthesis filter memory */
|
||||
Float *ltnfm, /* long-term noise feedback filter memory */
|
||||
Float *stnfm, /* short-term noise feedback filter memory */
|
||||
Float *cb, /* scalar quantizer codebook */
|
||||
int pp); /* pitch period (# of 8 kHz samples) */
|
||||
|
||||
extern int bv32_gainquan(Float *gainq,
|
||||
Float lg,
|
||||
Float *lgpm,
|
||||
Float *prevlg,
|
||||
Float level);
|
||||
|
||||
extern void bv32_lspquan(Float *lspq,
|
||||
int16_t *lspidx,
|
||||
Float *lsp,
|
||||
Float *lsppm);
|
||||
|
||||
extern void bv32_pp3dec(int16_t idx, Float *b);
|
|
@ -1,112 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* fineptch.c -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv32fine_pitch.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bv32cnst.h"
|
||||
#include "bv32externs.h"
|
||||
|
||||
#define FS (XOFF + 1) /* Frame Starting index */
|
||||
#define FE (XOFF + FRSZ) /* Frame Ending index */
|
||||
#define DEV 6
|
||||
|
||||
int bv32_refinepitch(Float *x, int cpp, Float *ppt)
|
||||
{
|
||||
Float cor;
|
||||
Float cor2;
|
||||
Float energy;
|
||||
Float cormax;
|
||||
Float cor2max;
|
||||
Float energymax;
|
||||
Float *fp0;
|
||||
Float *fp1;
|
||||
Float *fp2;
|
||||
Float *fp3;
|
||||
int lb;
|
||||
int ub;
|
||||
int pp;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
if (cpp >= MAXPP)
|
||||
cpp = MAXPP - 1;
|
||||
if (cpp < MINPP)
|
||||
cpp = MINPP;
|
||||
lb = cpp - DEV;
|
||||
if (lb < MINPP)
|
||||
lb = MINPP; /* lower bound of pitch period search range */
|
||||
ub = cpp + DEV;
|
||||
/* to avoid selecting MAXPP as the refined pitch period */
|
||||
if (ub >= MAXPP)
|
||||
ub = MAXPP - 1; /* lower bound of pitch period search range */
|
||||
|
||||
i = lb; /* start the search from lower bound */
|
||||
|
||||
fp0 = x + FS - 1;
|
||||
fp1 = x + FS - 1 - i;
|
||||
cor = energy = 0.0;
|
||||
for (j = 0; j < (FE - FS + 1); j++)
|
||||
{
|
||||
energy += (*fp1) * (*fp1);
|
||||
cor += (*fp0++) * (*fp1++);
|
||||
}
|
||||
|
||||
pp = i;
|
||||
cormax = cor;
|
||||
cor2max = cor*cor;
|
||||
energymax = energy;
|
||||
|
||||
fp0 = x + FE - lb - 1;
|
||||
fp1 = x + FS - lb - 2;
|
||||
for (i = lb + 1; i <= ub; i++)
|
||||
{
|
||||
fp2 = x + FS - 1;
|
||||
fp3 = x + FS - i - 1;
|
||||
cor = 0.;
|
||||
for (j = 0; j < (FE - FS + 1); j++)
|
||||
cor += (*fp2++)*(*fp3++);
|
||||
cor2 = cor*cor;
|
||||
energy += ((*fp1)*(*fp1) - (*fp0)*(*fp0));
|
||||
fp0--;
|
||||
fp1--;
|
||||
if ((cor2*energymax) > (cor2max*energy))
|
||||
{
|
||||
pp = i;
|
||||
cormax = cor;
|
||||
cor2max = cor2;
|
||||
energymax = energy;
|
||||
}
|
||||
}
|
||||
|
||||
*ppt = (energymax != 0) ? (cormax/energymax) : 0.0;
|
||||
|
||||
return pp;
|
||||
}
|
|
@ -1,145 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* lspquan.c - Quantize LSPs.
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv32gaindec.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bv32externs.h"
|
||||
|
||||
Float bv32_gaindec(Float *lgq,
|
||||
int16_t gidx,
|
||||
Float *lgpm,
|
||||
Float *prevlg, /* previous log gains (last two frames) */
|
||||
Float level, /* input level estimate */
|
||||
int16_t *nclglim,
|
||||
int16_t lctimer)
|
||||
{
|
||||
Float gainq;
|
||||
Float elg;
|
||||
Float lgc;
|
||||
Float lgq_nh;
|
||||
int i;
|
||||
int n;
|
||||
int k;
|
||||
|
||||
/* CALCULATE ESTIMATED LOG-GAIN (WITH MEAN VALUE OF LOG GAIN RESTORED) */
|
||||
elg = bv32_lgmean;
|
||||
for (i = 0; i < LGPORDER; i++)
|
||||
elg += bv32_lgp[i]*lgpm[i];
|
||||
|
||||
/* CALCULATE DECODED LOG-GAIN */
|
||||
*lgq = bv32_lgpecb[gidx] + elg;
|
||||
|
||||
/* next higher gain */
|
||||
if (gidx < LGPECBSZ - 1)
|
||||
{
|
||||
lgq_nh = bv32_lgpecb_nh[gidx] + elg;
|
||||
if (*lgq < MinE && fabs(lgq_nh-MinE) < fabs(*lgq-MinE))
|
||||
{
|
||||
/* To avoid thresholding when the enc Q makes it below the threshold */
|
||||
*lgq = MinE;
|
||||
}
|
||||
}
|
||||
|
||||
/* LOOK UP FROM lgclimit() TABLE THE MAXIMUM LOG GAIN CHANGE ALLOWED */
|
||||
i = (int) ((prevlg[0] - level - LGLB) * 0.5F); /* get column index */
|
||||
if (i >= NGB)
|
||||
i = NGB - 1;
|
||||
else if (i < 0)
|
||||
i = 0;
|
||||
n = (int) ((prevlg[0] - prevlg[1] - GCLB) * 0.5F); /* get row index */
|
||||
if (n >= NGCB)
|
||||
n = NGCB - 1;
|
||||
else if (n < 0)
|
||||
n = 0;
|
||||
i = i * NGCB + n;
|
||||
|
||||
/* UPDATE LOG-GAIN PREDICTOR MEMORY, CHECK WHETHER DECODED LOG-GAIN EXCEEDS LGCLIMIT */
|
||||
for (k = LGPORDER - 1; k > 0; k--)
|
||||
lgpm[k] = lgpm[k-1];
|
||||
lgc = *lgq - prevlg[0];
|
||||
if (lgc > bv32_lgclimit[i] && gidx > 0 && lctimer == 0) /* if decoded log-gain exceeds limit */
|
||||
{
|
||||
*lgq = prevlg[0]; /* use the log-gain of previous frame */
|
||||
lgpm[0] = *lgq - elg;
|
||||
*nclglim = *nclglim + 1;
|
||||
if (*nclglim > NCLGLIM_TRAPPED)
|
||||
*nclglim = NCLGLIM_TRAPPED;
|
||||
}
|
||||
else
|
||||
{
|
||||
lgpm[0] = bv32_lgpecb[gidx];
|
||||
*nclglim = 0;
|
||||
}
|
||||
|
||||
/* UPDATE PREVIOUS LOG-GAINS */
|
||||
prevlg[1] = prevlg[0];
|
||||
prevlg[0] = *lgq;
|
||||
|
||||
/* CONVERT QUANTIZED LOG-GAIN TO LINEAR DOMAIN */
|
||||
gainq = pow(2.0F, 0.5F * *lgq);
|
||||
|
||||
return gainq;
|
||||
}
|
||||
|
||||
void bv32_gainplc(Float E,
|
||||
Float *lgeqm,
|
||||
Float *lgqm)
|
||||
{
|
||||
int k;
|
||||
Float pe, lg, mrlg, elg, lge;
|
||||
|
||||
pe = INVSFRSZ * E;
|
||||
|
||||
if (pe - TMinlg > 0.0)
|
||||
lg = log(pe)/log(2.0);
|
||||
else
|
||||
lg = Minlg;
|
||||
|
||||
mrlg = lg - bv32_lgmean;
|
||||
|
||||
elg = 0.0;
|
||||
for (k = 0; k < GPO; k++)
|
||||
elg += bv32_lgp[k]*lgeqm[k];
|
||||
|
||||
/* predicted log-gain error */
|
||||
lge = mrlg - elg;
|
||||
|
||||
/* update quantizer memory */
|
||||
for (k = GPO - 1; k > 0; k--)
|
||||
lgeqm[k] = lgeqm[k-1];
|
||||
lgeqm[0] = lge;
|
||||
|
||||
/* update quantized log-gain memory */
|
||||
lgqm[1] = lgqm[0];
|
||||
lgqm[0] = lg;
|
||||
}
|
|
@ -1,116 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* gainquan.c - Quantize gains.
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv32gainquan.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include "typedef.h"
|
||||
#include "bv32externs.h"
|
||||
|
||||
int bv32_gainquan(Float *gainq,
|
||||
Float lg,
|
||||
Float *lgpm,
|
||||
Float *prevlg, /* previous log gains (last two frames) */
|
||||
Float level) /* input level estimate */
|
||||
{
|
||||
Float elg;
|
||||
Float lgpe;
|
||||
Float limit;
|
||||
Float dmin;
|
||||
Float d;
|
||||
int i;
|
||||
int n;
|
||||
int gidx = 0;
|
||||
const int *p_gidx;
|
||||
|
||||
/* CALCULATE ESTIMATED LOG-GAIN */
|
||||
elg = bv32_lgmean;
|
||||
for (i = 0; i < LGPORDER; i++)
|
||||
elg += bv32_lgp[i]*lgpm[i];
|
||||
|
||||
/* SUBTRACT LOG-GAIN MEAN & ESTIMATED LOG-GAIN TO GET PREDICTION ERROR */
|
||||
lgpe = lg - elg;
|
||||
|
||||
/* SCALAR QUANTIZATION OF LOG-GAIN PREDICTION ERROR */
|
||||
dmin = 1e30;
|
||||
p_gidx = bv32_idxord;
|
||||
for (i = 0; i < LGPECBSZ; i++)
|
||||
{
|
||||
d = lgpe - bv32_lgpecb[*p_gidx++];
|
||||
if (d < 0.0F)
|
||||
{
|
||||
d = -d;
|
||||
}
|
||||
if (d < dmin)
|
||||
{
|
||||
dmin = d;
|
||||
/* index into ordered codebook */
|
||||
gidx=i;
|
||||
}
|
||||
}
|
||||
|
||||
/* CALCULATE QUANTIZED LOG-GAIN */
|
||||
*gainq = bv32_lgpecb[bv32_idxord[gidx]] + elg;
|
||||
|
||||
/* LOOK UP FROM lgclimit() TABLE THE MAXIMUM LOG GAIN CHANGE ALLOWED */
|
||||
i = (int) ((prevlg[0] - level - LGLB) * 0.5F); /* get column index */
|
||||
if (i >= NGB)
|
||||
i = NGB - 1;
|
||||
else if (i < 0)
|
||||
i = 0;
|
||||
n = (int) ((prevlg[0] - prevlg[1] - GCLB) * 0.5F); /* get row index */
|
||||
if (n >= NGCB)
|
||||
n = NGCB - 1;
|
||||
else if (n < 0)
|
||||
n = 0;
|
||||
i = i*NGCB + n;
|
||||
|
||||
/* CHECK WHETHER QUANTIZED LOG-GAIN CAUSE A GAIN CHANGE > LGCLIMIT */
|
||||
limit = prevlg[0] + bv32_lgclimit[i];/* limit that log-gain shouldn't exceed */
|
||||
while (*gainq > limit && gidx > 0) /* if quantized gain exceeds limit */
|
||||
{
|
||||
gidx -= 1; /* decrement gain quantizer index by 1 */
|
||||
*gainq = bv32_lgpecb[bv32_idxord[gidx]] + elg; /* use next quantizer output*/
|
||||
}
|
||||
/* get true codebook index */
|
||||
gidx = bv32_idxord[gidx];
|
||||
|
||||
/* UPDATE LOG-GAIN PREDICTOR MEMORY */
|
||||
prevlg[1] = prevlg[0];
|
||||
prevlg[0] = *gainq;
|
||||
for (i = LGPORDER - 1; i > 0; i--)
|
||||
lgpm[i] = lgpm[i - 1];
|
||||
lgpm[0] = bv32_lgpecb[gidx];
|
||||
|
||||
/* CONVERT QUANTIZED LOG-GAIN TO LINEAR DOMAIN */
|
||||
*gainq = pow(2.0F, 0.5F * *gainq);
|
||||
|
||||
return gidx;
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* levelest.c -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv32levelest.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bv32cnst.h"
|
||||
#include "bv32externs.h"
|
||||
|
||||
Float bv32_estlevel(Float lg,
|
||||
Float *level,
|
||||
Float *lmax,
|
||||
Float *lmin,
|
||||
Float *lmean,
|
||||
Float *x1)
|
||||
{
|
||||
Float lth;
|
||||
|
||||
/* UPDATE THE NEW MAXIMUM, MINIMUM, & MEAN OF LOG-GAIN */
|
||||
if (lg > *lmax)
|
||||
*lmax = lg; /* use new log-gain as max if it is > max */
|
||||
else
|
||||
*lmax = *lmean + estl_alpha*(*lmax - *lmean); /* o.w. attenuate toward lmean */
|
||||
if (lg < *lmin)
|
||||
*lmin=lg; /* use new log-gain as min if it is < min */
|
||||
else
|
||||
*lmin = *lmean + estl_alpha*(*lmin - *lmean); /* o.w. attenuate toward lmean */
|
||||
*lmean = estl_beta*(*lmean) + estl_beta1*(0.5*(*lmax + *lmin));
|
||||
|
||||
/* UPDATE ESTIMATED INPUT LEVEL, BY CALCULATING A RUNNING AVERAGE
|
||||
(USING AN EXPONENTIAL WINDOW) OF LOG-GAINS EXCEEDING lmean */
|
||||
lth = *lmean + estl_TH*(*lmax - *lmean);
|
||||
if (lg > lth)
|
||||
{
|
||||
*x1 = estl_a*(*x1) + estl_a1*lg;
|
||||
*level = estl_a*(*level) + estl_a1*(*x1);
|
||||
}
|
||||
|
||||
return lth;
|
||||
}
|
|
@ -1,166 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* bv32lspdec.c - Decode LSPs.
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv32lspdec.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include "typedef.h"
|
||||
#include "bv32externs.h"
|
||||
#include "bvcommon.h"
|
||||
|
||||
static void vqdec(Float *, int16_t, const Float *, int);
|
||||
|
||||
void bv32_lspdec(Float *lspq,
|
||||
int16_t *lspidx,
|
||||
Float *lsppm,
|
||||
Float *lspq_last)
|
||||
{
|
||||
Float elsp[LPCO];
|
||||
Float lspe[LPCO];
|
||||
Float lspeq1[LPCO];
|
||||
Float lspeq2[LPCO];
|
||||
Float a0;
|
||||
const Float *fp1;
|
||||
Float *fp2;
|
||||
Float *fp3;
|
||||
int i;
|
||||
int k;
|
||||
int lsfdordr;
|
||||
|
||||
/* CALCULATE ESTIMATED (MA-PREDICTED) LSP VECTOR */
|
||||
fp1 = bv32_lspp;
|
||||
fp2 = lsppm;
|
||||
for (i = 0; i < LPCO; i++)
|
||||
{
|
||||
a0 = 0.0F;
|
||||
for (k = 0; k < LSPPORDER; k++)
|
||||
a0 += *fp1++ * *fp2++;
|
||||
elsp[i] = a0;
|
||||
}
|
||||
|
||||
/* PERFORM FIRST-STAGE VQ CODEBOOK DECODE */
|
||||
vqdec(lspeq1, lspidx[0], bv32_lspecb1, LPCO);
|
||||
|
||||
/* PERFORM SECOND-STAGE VQ CODEBOOK DECODE */
|
||||
vqdec(lspeq2, lspidx[1], bv32_lspecb21, SVD1);
|
||||
vqdec(lspeq2 + SVD1, lspidx[2], bv32_lspecb22, SVD2);
|
||||
|
||||
/* GET OVERALL QUANTIZER OUTPUT VECTOR OF THE TWO-STAGE VQ */
|
||||
/* AND CALCULATE QUANTIZED LSP */
|
||||
for (i = 0; i < LPCO; i++)
|
||||
{
|
||||
lspe[i] = lspeq1[i] + lspeq2[i];
|
||||
lspq[i] = lspe[i] + elsp[i] + bv32_lspmean[i];
|
||||
}
|
||||
|
||||
/* detect bit-errors based on ordering property */
|
||||
if (lspq[0] < 0.0)
|
||||
lsfdordr = 1;
|
||||
else
|
||||
lsfdordr = 0;
|
||||
for (i = 1; i < SVD1; i++)
|
||||
{
|
||||
if (lspq[i] - lspq[i-1] < 0.0)
|
||||
lsfdordr = 1;
|
||||
}
|
||||
|
||||
/* substitute LSP and MA predictor update if bit-error detected */
|
||||
if (lsfdordr)
|
||||
{
|
||||
for (i = 0; i < LPCO; i++)
|
||||
{
|
||||
lspq[i] = lspq_last[i];
|
||||
lspe[i] = lspq[i] - elsp[i] - bv32_lspmean[i];
|
||||
}
|
||||
}
|
||||
|
||||
/* UPDATE LSP MA PREDICTOR MEMORY */
|
||||
i = LPCO * LSPPORDER - 1;
|
||||
fp3 = &lsppm[i];
|
||||
fp2 = &lsppm[i - 1];
|
||||
for (i = LPCO - 1; i >= 0; i--)
|
||||
{
|
||||
for (k = LSPPORDER; k > 1; k--)
|
||||
*fp3-- = *fp2--;
|
||||
*fp3-- = lspe[i];
|
||||
fp2--;
|
||||
}
|
||||
|
||||
/* ENSURE CORRECT ORDERING & MINIMUM SPACING TO GUARANTEE STABILITY */
|
||||
stblz_lsp(lspq, LPCO);
|
||||
}
|
||||
|
||||
static void vqdec(Float *xq, /* VQ output vector (quantized version of input vector) */
|
||||
int16_t idx, /* VQ codebook index for the nearest neighbor */
|
||||
const Float *cb, /* VQ codebook */
|
||||
int vdim) /* vector dimension */
|
||||
{
|
||||
int j;
|
||||
int k;
|
||||
|
||||
j = idx * vdim;
|
||||
for (k = 0; k < vdim; k++)
|
||||
xq[k] = cb[j + k];
|
||||
}
|
||||
|
||||
|
||||
void bv32_lspplc(Float *lspq,
|
||||
Float *lsppm)
|
||||
{
|
||||
Float elsp[LPCO];
|
||||
Float a0;
|
||||
const Float *fp1;
|
||||
Float *fp2;
|
||||
Float *fp3;
|
||||
int i, k;
|
||||
|
||||
/* CALCULATE ESTIMATED (MA-PREDICTED) LSP VECTOR */
|
||||
fp1 = bv32_lspp;
|
||||
fp2 = lsppm;
|
||||
for (i = 0; i < LPCO; i++)
|
||||
{
|
||||
a0 = 0.0F;
|
||||
for (k = 0; k < LSPPORDER; k++)
|
||||
a0 += *fp1++ * *fp2++;
|
||||
elsp[i] = a0;
|
||||
}
|
||||
|
||||
/* UPDATE LSP MA PREDICTOR MEMORY */
|
||||
i = LPCO * LSPPORDER - 1;
|
||||
fp3 = &lsppm[i];
|
||||
fp2 = &lsppm[i - 1];
|
||||
for (i = LPCO - 1; i >= 0; i--)
|
||||
{
|
||||
for (k = LSPPORDER; k > 1; k--)
|
||||
*fp3-- = *fp2--;
|
||||
*fp3-- = lspq[i] - bv32_lspmean[i] - elsp[i];
|
||||
fp2--;
|
||||
}
|
||||
}
|
|
@ -1,264 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* lspquan.c - Quantize LSPs.
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include "typedef.h"
|
||||
#include "bv32externs.h"
|
||||
#include "bvcommon.h"
|
||||
|
||||
static void vqmse(Float *xq, int16_t *idx, Float *x, const Float *cb, int vdim, int cbsz);
|
||||
static void vqwmse_stbl(Float *xq, int16_t *idx, Float *x, Float *w, Float *xa,
|
||||
const Float *cb, int vdim, int cbsz);
|
||||
static void vqwmse(Float *xq, int16_t *idx, Float *x, Float *w, const Float *cb, int vdim,
|
||||
int cbsz);
|
||||
|
||||
void bv32_lspquan(Float *lspq,
|
||||
int16_t *lspidx,
|
||||
Float *lsp,
|
||||
Float *lsppm)
|
||||
{
|
||||
Float d[LPCO];
|
||||
Float w[LPCO];
|
||||
Float elsp[LPCO];
|
||||
Float lspe[LPCO];
|
||||
Float lspeq1[LPCO];
|
||||
Float lspeq2[LPCO];
|
||||
Float lspa[LPCO];
|
||||
Float a0;
|
||||
const Float *fp1;
|
||||
Float *fp2;
|
||||
Float *fp3;
|
||||
int i;
|
||||
int k;
|
||||
|
||||
/* CALCULATE THE WEIGHTS FOR WEIGHTED MEAN-SQUARE ERROR DISTORTION */
|
||||
for (i = 0; i < LPCO - 1; i++)
|
||||
d[i] = lsp[i + 1] - lsp[i]; /* LSP difference vector */
|
||||
w[0] = 1.0F / d[0];
|
||||
for (i = 1; i < LPCO - 1; i++)
|
||||
{
|
||||
if (d[i] < d[i - 1])
|
||||
w[i] = 1.0F/d[i];
|
||||
else
|
||||
w[i] = 1.0F/d[i - 1];
|
||||
}
|
||||
w[LPCO - 1] = 1.0F/d[LPCO - 2];
|
||||
|
||||
/* CALCULATE ESTIMATED (MA-PREDICTED) LSP VECTOR */
|
||||
fp1 = bv32_lspp;
|
||||
fp2 = lsppm;
|
||||
for (i = 0; i < LPCO; i++)
|
||||
{
|
||||
a0 = 0.0F;
|
||||
for (k = 0; k < LSPPORDER; k++)
|
||||
a0 += *fp1++ * *fp2++;
|
||||
elsp[i] = a0;
|
||||
}
|
||||
|
||||
/* SUBTRACT LSP MEAN VALUE & ESTIMATED LSP TO GET PREDICTION ERROR */
|
||||
for (i = 0; i < LPCO; i++)
|
||||
lspe[i] = lsp[i] - bv32_lspmean[i] - elsp[i];
|
||||
|
||||
/* PERFORM FIRST-STAGE VQ CODEBOOK SEARCH, MSE VQ */
|
||||
vqmse(lspeq1, &lspidx[0], lspe, bv32_lspecb1, LPCO, LSPECBSZ1);
|
||||
|
||||
/* CALCULATE QUANTIZATION ERROR VECTOR OF FIRST-STAGE VQ */
|
||||
for (i = 0; i < LPCO; i++)
|
||||
d[i] = lspe[i] - lspeq1[i];
|
||||
|
||||
/* PERFORM SECOND-STAGE VQ CODEBOOK SEARCH */
|
||||
for (i = 0; i < SVD1; i++)
|
||||
lspa[i] = bv32_lspmean[i] + elsp[i] + lspeq1[i];
|
||||
vqwmse_stbl(lspeq2, &lspidx[1], d, w, lspa, bv32_lspecb21, SVD1, LSPECBSZ21);
|
||||
vqwmse(&lspeq2[SVD1], &lspidx[2], &d[SVD1], &w[SVD1], bv32_lspecb22, SVD2, LSPECBSZ22);
|
||||
|
||||
/* GET OVERALL QUANTIZER OUTPUT VECTOR OF THE TWO-STAGE VQ */
|
||||
for (i = 0; i < LPCO; i++)
|
||||
lspe[i] = lspeq1[i] + lspeq2[i];
|
||||
|
||||
/* UPDATE LSP MA PREDICTOR MEMORY */
|
||||
i = LPCO * LSPPORDER - 1;
|
||||
fp3 = &lsppm[i];
|
||||
fp2 = &lsppm[i - 1];
|
||||
for (i = LPCO - 1; i >= 0; i--)
|
||||
{
|
||||
for (k = LSPPORDER; k > 1; k--)
|
||||
*fp3-- = *fp2--;
|
||||
*fp3-- = lspe[i];
|
||||
fp2--;
|
||||
}
|
||||
|
||||
/* CALCULATE QUANTIZED LSP */
|
||||
for (i = 0; i < LPCO; i++)
|
||||
lspq[i] = lspe[i] + elsp[i] + bv32_lspmean[i];
|
||||
|
||||
/* ENSURE CORRECT ORDERING & MINIMUM SPACING TO GUARANTEE STABILITY */
|
||||
stblz_lsp(lspq, LPCO);
|
||||
}
|
||||
|
||||
/* MSE VQ */
|
||||
static void vqmse(Float *xq, /* VQ output vector (quantized version of input vector) */
|
||||
int16_t *idx, /* VQ codebook index for the nearest neighbor */
|
||||
Float *x, /* input vector */
|
||||
const Float *cb, /* VQ codebook */
|
||||
int vdim, /* vector dimension */
|
||||
int cbsz) /* codebook size (number of codevectors) */
|
||||
{
|
||||
const Float *fp1;
|
||||
Float dmin;
|
||||
Float d;
|
||||
int j;
|
||||
int k;
|
||||
Float e;
|
||||
|
||||
fp1 = cb;
|
||||
dmin = 1.0e30;
|
||||
for (j = 0; j < cbsz; j++)
|
||||
{
|
||||
d = 0.0F;
|
||||
for (k = 0; k < vdim; k++)
|
||||
{
|
||||
e = x[k] - (*fp1++);
|
||||
d += e * e;
|
||||
}
|
||||
if (d < dmin)
|
||||
{
|
||||
dmin = d;
|
||||
*idx = (int16_t) j;
|
||||
}
|
||||
}
|
||||
|
||||
j = *idx * vdim;
|
||||
for (k = 0; k < vdim; k++)
|
||||
xq[k] = cb[j + k];
|
||||
}
|
||||
|
||||
/* WMSE VQ with enforcement of ordering property */
|
||||
static void vqwmse_stbl(Float *xq, /* VQ output vector (quantized version of input vector) */
|
||||
int16_t *idx, /* VQ codebook index for the nearest neighbor */
|
||||
Float *x, /* input vector */
|
||||
Float *w, /* weights for weighted Mean-Square Error */
|
||||
Float *xa, /* lsp approximation */
|
||||
const Float *cb, /* VQ codebook */
|
||||
int vdim, /* vector dimension */
|
||||
int cbsz) /* codebook size (number of codevectors) */
|
||||
{
|
||||
Float a0;
|
||||
const Float *fp1;
|
||||
const Float *fp2;
|
||||
Float dmin;
|
||||
Float d;
|
||||
Float xqc[LPCO];
|
||||
int j;
|
||||
int k;
|
||||
int stbl;
|
||||
|
||||
fp1 = cb;
|
||||
dmin = 1.0e30;
|
||||
*idx = -1;
|
||||
for (j = 0; j < cbsz; j++)
|
||||
{
|
||||
/* Check stability */
|
||||
fp2 = fp1;
|
||||
xqc[0] = xa[0] + *fp2++;
|
||||
stbl = (xqc[0] < 0.0) ? 0 : 1;
|
||||
for (k = 1; k < vdim; k++)
|
||||
{
|
||||
xqc[k] = xa[k] + *fp2++;
|
||||
if (xqc[k] - xqc[k-1] < 0.0)
|
||||
stbl = 0;
|
||||
}
|
||||
|
||||
/* Calculate distortion */
|
||||
d = 0.0F;
|
||||
for (k = 0; k < vdim; k++)
|
||||
{
|
||||
a0 = x[k] - *fp1++;
|
||||
d += w[k] * a0 * a0;
|
||||
}
|
||||
|
||||
if (stbl > 0)
|
||||
{
|
||||
if (d < dmin)
|
||||
{
|
||||
dmin = d;
|
||||
*idx = (int16_t) j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (*idx == -1)
|
||||
{
|
||||
//printf("\nWARNING: Encoder-decoder synchronization lost for clean channel!!!\n");
|
||||
*idx = 1;
|
||||
}
|
||||
|
||||
fp1 = cb + (*idx)*vdim;
|
||||
for (k = 0; k < vdim; k++)
|
||||
xq[k] = *fp1++;
|
||||
}
|
||||
|
||||
/* MSE VQ */
|
||||
static void vqwmse(Float *xq, /* VQ output vector (quantized version of input vector) */
|
||||
int16_t *idx, /* VQ codebook index for the nearest neighbor */
|
||||
Float *x, /* input vector */
|
||||
Float *w, /* weights for weighted Mean-Square Error */
|
||||
const Float *cb, /* VQ codebook */
|
||||
int vdim, /* vector dimension */
|
||||
int cbsz) /* codebook size (number of codevectors) */
|
||||
{
|
||||
Float a0;
|
||||
const Float *fp1;
|
||||
Float dmin;
|
||||
Float d;
|
||||
int j;
|
||||
int k;
|
||||
|
||||
fp1 = cb;
|
||||
dmin = 1.0e30;
|
||||
for (j = 0; j < cbsz; j++)
|
||||
{
|
||||
d = 0.0F;
|
||||
for (k = 0; k < vdim; k++)
|
||||
{
|
||||
a0 = x[k] - *fp1++;
|
||||
d += w[k]*a0*a0;
|
||||
}
|
||||
if (d < dmin)
|
||||
{
|
||||
dmin = d;
|
||||
*idx = (int16_t) j;
|
||||
}
|
||||
}
|
||||
|
||||
j = *idx * vdim;
|
||||
for (k = 0; k < vdim; k++)
|
||||
xq[k] = cb[j + k];
|
||||
}
|
|
@ -1,150 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* plc.c - Packet loss concealment.
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv32plc.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bv32cnst.h"
|
||||
#include "utility.h"
|
||||
#include "bvcommon.h"
|
||||
#include "bv32externs.h"
|
||||
#include "bv32strct.h"
|
||||
#include "broadvoice/broadvoice.h"
|
||||
|
||||
BV_DECLARE(int) bv32_fillin(bv32_decode_state_t *ds, int16_t amp[], int len)
|
||||
{
|
||||
int n;
|
||||
int i_sf;
|
||||
Float r[SFRSZ]; /* random excitation */
|
||||
Float E;
|
||||
Float gain;
|
||||
Float tmp;
|
||||
Float xq[SFRSZ];
|
||||
Float d[LTMOFF + FRSZ]; /* long-term synthesis filter memory */
|
||||
|
||||
/************************************************************/
|
||||
/* Copy decoder state memory */
|
||||
/************************************************************/
|
||||
Fcopy(d, ds->ltsym, LTMOFF); /* excitation */
|
||||
|
||||
/************************************************************/
|
||||
/* Update counter of consecutive list frames */
|
||||
/************************************************************/
|
||||
if (ds->cfecount < HoldPLCG + AttnPLCG - 1)
|
||||
ds->cfecount++;
|
||||
|
||||
/* loop over subframes */
|
||||
for (i_sf = 0; i_sf < FECNSF; i_sf++)
|
||||
{
|
||||
/* Generate Unscaled Excitation */
|
||||
E = 0.0;
|
||||
for (n = 0; n < SFRSZ; n++)
|
||||
{
|
||||
ds->idum = 1664525L*ds->idum + 1013904223L;
|
||||
r[n] = (Float)(ds->idum >> 16) - 32767.0;
|
||||
E += r[n] * r[n];
|
||||
}
|
||||
|
||||
/* Calculate Scaling */
|
||||
ds->scplcg = ScPLCG_a + ScPLCG_b * ds->per;
|
||||
if (ds->scplcg > ScPLCGmax)
|
||||
ds->scplcg = ScPLCGmax;
|
||||
else if (ds->scplcg < ScPLCGmin)
|
||||
ds->scplcg = ScPLCGmin;
|
||||
gain = ds->scplcg * sqrt(ds->E/E);
|
||||
|
||||
/* Long-term synthesis filter */
|
||||
for (n = 0; n < SFRSZ; n++)
|
||||
{
|
||||
d[LTMOFF+i_sf*SFRSZ+n] = gain * r[n];
|
||||
d[LTMOFF+i_sf*SFRSZ+n] += ds->bq_last[0] * d[LTMOFF+i_sf*SFRSZ+n-ds->pp_last+1];
|
||||
d[LTMOFF+i_sf*SFRSZ+n] += ds->bq_last[1] * d[LTMOFF+i_sf*SFRSZ+n-ds->pp_last];
|
||||
d[LTMOFF+i_sf*SFRSZ+n] += ds->bq_last[2] * d[LTMOFF+i_sf*SFRSZ+n-ds->pp_last-1];
|
||||
}
|
||||
|
||||
/************************************************************/
|
||||
/* Short-term synthesis filter */
|
||||
/************************************************************/
|
||||
apfilter(ds->atplc, LPCO, d+i_sf*SFRSZ+LTMOFF, xq, SFRSZ, ds->stsym, 1);
|
||||
|
||||
/**********************************************************/
|
||||
/* De-emphasis filter */
|
||||
/**********************************************************/
|
||||
for (n = 0; n < SFRSZ; n++)
|
||||
{
|
||||
tmp = xq[n] + PEAPFC*ds->dezfm[0] - PEAZFC*ds->depfm[0];
|
||||
ds->dezfm[0] = xq[n];
|
||||
ds->depfm[0] = tmp;
|
||||
if (tmp >= 0)
|
||||
tmp += 0.5;
|
||||
else tmp -= 0.5;
|
||||
|
||||
if (tmp > 32767.0)
|
||||
tmp = 32767.0;
|
||||
else if (tmp < -32768.0)
|
||||
tmp = -32768.0;
|
||||
amp[i_sf*SFRSZ + n] = (int16_t) tmp;
|
||||
}
|
||||
|
||||
/************************************************************/
|
||||
/* Update memory of predictive gain quantizer */
|
||||
/************************************************************/
|
||||
bv32_gainplc(ds->E, ds->lgpm, ds->prevlg);
|
||||
|
||||
/* Estimate the signal level */
|
||||
bv32_estlevel(ds->prevlg[0], &ds->level, &ds->lmax, &ds->lmin, &ds->lmean, &ds->x1);
|
||||
}
|
||||
|
||||
/************************************************************/
|
||||
/* Save decoder state memory */
|
||||
/************************************************************/
|
||||
Fcopy(ds->ltsym, d + FRSZ, LTMOFF);
|
||||
|
||||
/************************************************************/
|
||||
/* Update memory of predictive LSP quantizer */
|
||||
/************************************************************/
|
||||
bv32_lspplc(ds->lsplast,ds->lsppm);
|
||||
|
||||
/************************************************************/
|
||||
/* Attenuation during long packet losses */
|
||||
/************************************************************/
|
||||
if (ds->cfecount >= HoldPLCG)
|
||||
{
|
||||
gain = 1.0 - AttnFacPLCG*(Float) (ds->cfecount - (HoldPLCG - 1));
|
||||
ds->bq_last[0] = gain*ds->bq_last[0];
|
||||
ds->bq_last[1] = gain*ds->bq_last[1];
|
||||
ds->bq_last[2] = gain*ds->bq_last[2];
|
||||
ds->E = gain*gain*ds->E;
|
||||
}
|
||||
return FRSZ;
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* bv32ptdec.c -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv32ptdec.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bv32externs.h"
|
||||
|
||||
void bv32_pp3dec(int16_t idx, Float *b)
|
||||
{
|
||||
const Float *fp;
|
||||
int i;
|
||||
|
||||
fp = bv32_pp9cb + idx*9;
|
||||
for (i = 0; i < 3; i++)
|
||||
b[i] = fp[i]*0.5;
|
||||
}
|
|
@ -1,124 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* ptquan.c -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv32ptquan.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bv32cnst.h"
|
||||
#include "bvcommon.h"
|
||||
#include "bv32externs.h"
|
||||
|
||||
int bv32_pitchtapquan(Float *x,
|
||||
int pp,
|
||||
Float *b)
|
||||
{
|
||||
Float p[9];
|
||||
Float t;
|
||||
Float s0;
|
||||
Float s1;
|
||||
Float s2;
|
||||
Float cormax;
|
||||
Float cor;
|
||||
Float t0;
|
||||
Float t1;
|
||||
Float t2;
|
||||
Float *xt;
|
||||
const Float *fp0;
|
||||
Float *fp1;
|
||||
const Float *fp2;
|
||||
int ppm2;
|
||||
int qidx = 0;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
ppm2 = pp - 2;
|
||||
xt = x + XOFF;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
fp0 = xt;
|
||||
fp1 = x + XOFF - ppm2 - i - 1;
|
||||
t = 0;
|
||||
for (j = 0; j < FRSZ; j++)
|
||||
t += (*fp0++) * (*fp1++);
|
||||
p[i] = t;
|
||||
}
|
||||
|
||||
fp0 = x + XOFF - ppm2 - 3;
|
||||
s0 = *fp0++;
|
||||
s1 = *fp0++;
|
||||
s2 = *fp0--;
|
||||
t0 = p[8] = s0*s0;
|
||||
t1 = p[4] = s0*s1;
|
||||
p[5] = s0*s2;
|
||||
s0 = *fp0++;
|
||||
s1 = *fp0++;
|
||||
s2 = *fp0--;
|
||||
t2 = s0*s0;
|
||||
p[8] += t2;
|
||||
p[4] += s0*s1;
|
||||
p[5] += s0*s2;
|
||||
for (i = 0; i < (FRSZ - 2); i++)
|
||||
{
|
||||
s0 = *fp0++;
|
||||
s1 = *fp0++;
|
||||
s2 = *fp0--;
|
||||
p[8] += s0*s0;
|
||||
p[4] += s0*s1;
|
||||
p[5] += s0*s2;
|
||||
}
|
||||
s0 = *fp0++;
|
||||
s1 = *fp0++;
|
||||
s2 = *fp0--;
|
||||
p[7] = p[8] + (s0*s0) - t0;
|
||||
p[3] = p[4] + (s0*s1) - t1;
|
||||
p[6] = p[7] + (s1*s1) - t2;
|
||||
|
||||
cormax = -1.0e30;
|
||||
fp0 = bv32_pp9cb;
|
||||
for (i = 0; i < PPCBSZ; i++)
|
||||
{
|
||||
cor = 0.0;
|
||||
fp1 = p;
|
||||
for (j = 0; j < 9; j++)
|
||||
cor += (*fp0++)*(*fp1++);
|
||||
if (cor > cormax)
|
||||
{
|
||||
cormax = cor;
|
||||
qidx = i;
|
||||
}
|
||||
}
|
||||
|
||||
fp2 = bv32_pp9cb + qidx*9;
|
||||
for (i = 0; i < 3; i++)
|
||||
b[i] = fp2[i]*0.5;
|
||||
|
||||
return qidx;
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* bv32strct.h -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv32strct.h,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bv32cnst.h"
|
||||
#include "bvcommon.h"
|
||||
|
||||
#if !defined(_BV32STRCT_H_)
|
||||
#define _BV32STRCT_H_
|
||||
|
||||
struct bv32_decode_state_s
|
||||
{
|
||||
Float stsym[LPCO];
|
||||
Float ltsym[LTMOFF];
|
||||
Float lsppm[LPCO*LSPPORDER];
|
||||
Float lgpm[LGPORDER];
|
||||
Float lsplast[LPCO];
|
||||
Float dezfm[PFO];
|
||||
Float depfm[PFO];
|
||||
int16_t cfecount;
|
||||
uint32_t idum;
|
||||
Float E;
|
||||
Float scplcg;
|
||||
Float per;
|
||||
Float atplc[LPCO + 1];
|
||||
int16_t pp_last;
|
||||
Float prevlg[2];
|
||||
Float lgq_last;
|
||||
Float bq_last[3];
|
||||
Float lmax; /* level-adaptation */
|
||||
Float lmin;
|
||||
Float lmean;
|
||||
Float x1;
|
||||
Float level;
|
||||
int16_t nclglim;
|
||||
int16_t lctimer;
|
||||
};
|
||||
|
||||
struct bv32_encode_state_s
|
||||
{
|
||||
Float x[XOFF];
|
||||
Float xwd[XDOFF]; /* memory of DECF:1 decimated version of xw() */
|
||||
Float dq[XOFF]; /* quantized short-term pred error */
|
||||
Float dfm[DFO]; /* decimated xwd() filter memory */
|
||||
Float stpem[LPCO]; /* ST Pred. Error filter memory, low-band */
|
||||
Float stwpm[LPCO]; /* ST Weighting all-Pole Memory, low-band */
|
||||
Float stnfm[LPCO]; /* ST Noise Feedback filter Memory, Lowband */
|
||||
Float stsym[LPCO]; /* ST Synthesis filter Memory, Lowband */
|
||||
Float ltsym[MAXPP1 + FRSZ]; /* long-term synthesis filter memory */
|
||||
Float ltnfm[MAXPP1 + FRSZ]; /* long-term noise feedback filter memory */
|
||||
Float lsplast[LPCO];
|
||||
Float lsppm[LPCO*LSPPORDER]; /* LSP Predictor Memory */
|
||||
Float lgpm[LGPORDER];
|
||||
Float hpfzm[HPO];
|
||||
Float hpfpm[HPO];
|
||||
Float prevlg[2];
|
||||
Float lmax; /* level-adaptation */
|
||||
Float lmin;
|
||||
Float lmean;
|
||||
Float x1;
|
||||
Float level;
|
||||
int cpplast; /* pitch period pf the previous frame */
|
||||
Float allast[LPCO + 1];
|
||||
};
|
||||
|
||||
struct BV32_Bit_Stream
|
||||
{
|
||||
int16_t lspidx[3];
|
||||
int16_t ppidx;
|
||||
int16_t bqidx;
|
||||
int16_t gidx[2];
|
||||
int16_t qvidx[NVPSF];
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,744 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* tables.c - Constant data tables for the BroadVoice32 codec.
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bv32tables.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bv32cnst.h"
|
||||
#include "bv32externs.h"
|
||||
|
||||
/* spec */
|
||||
/* log-gain change limitation */
|
||||
const Float bv32_lgclimit[] =
|
||||
{
|
||||
0.00000, 0.13477, 2.26563, 2.94336, 4.71875, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000,
|
||||
0.00000, 0.64453, 4.90039, 3.38281, 4.58203, 5.69336, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000,
|
||||
0.00000, 0.33594, 7.27734, 5.82422, 11.66211, 11.66211, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000,
|
||||
6.31250, 5.50977, 4.83984, 6.99023, 8.22852, 11.49805, 1.89844, 0.00000, 0.00000, 0.00000, 0.00000,
|
||||
0.00000, 5.04883, 5.09180, 5.91406, 6.92188, 7.38086, 4.13867, 0.00000, 0.00000, 0.00000, 0.00000,
|
||||
-0.36523, 6.15625, 8.26953, 5.40430, 5.88477, 11.53906, 5.31836, -4.97070, 0.00000, 0.00000, 0.00000,
|
||||
5.51172, 6.31641, 9.66602, 7.58594, 10.63281, 12.03906, 8.79297, 3.06836, 0.00000, 0.00000, 0.00000,
|
||||
3.95703, 10.51172, 8.42969, 7.62891, 11.45703, 11.95898, 10.85352, 2.83008, 1.50000, 0.00000, 0.00000,
|
||||
7.37305, 8.93945, 8.57422, 6.85742, 9.67773, 11.54492, 10.98242, 10.43359, 2.53320, 5.05859, 0.00000,
|
||||
7.37305, 8.12109, 6.66406, 5.87891, 7.59766, 10.67969, 10.42578, 9.46875, 6.85938, 3.06445, 0.00000,
|
||||
4.39844, 5.94336, 5.73047, 5.10742, 5.69531, 8.31641, 10.05273, 8.23047, 7.11328, 3.04102, -1.27930,
|
||||
0.58789, 5.10938, 5.41602, 4.55273, 4.32813, 5.75586, 7.42383, 6.63867, 6.81055, 4.14258, 3.31641,
|
||||
0.14453, 5.64844, 5.05859, 4.06836, 3.51758, 4.07617, 4.56055, 4.99219, 5.51953, 4.82227, 5.19141,
|
||||
0.00000, 5.54688, 5.15625, 3.37891, 2.90430, 2.74805, 2.82422, 3.37500, 4.02930, 4.49805, 3.42188,
|
||||
0.00000, 0.39258, 3.92188, 2.67383, 2.66602, 2.40039, 4.65039, 3.29883, 2.16016, 2.95703, 0.40820,
|
||||
0.00000, 0.00000, 1.15039, 2.56641, 3.98438, 3.61133, 4.66797, 0.58398, -0.26563, 0.09570, 0.00000,
|
||||
0.00000, 0.00000, 0.37695, 4.30664, 7.07031, 0.81641, 2.86914, 1.19336, 0.69922, -1.23242, 0.00000,
|
||||
0.00000, 0.00000, 0.07617, 1.46875, 3.49219, 3.16992, -0.84180, 3.81250, -0.50781, 0.00000, 0.00000
|
||||
};
|
||||
|
||||
/* spec */
|
||||
const Float bv32_lspecb1[] =
|
||||
{
|
||||
-0.00384521, -0.00849915, -0.01591492, -0.00360107, -0.00013733, 0.00610352, 0.01640320, -0.00166321,
|
||||
-0.00511169, -0.01313782, -0.01698303, -0.00103760, -0.01216125, -0.00427246, -0.00271606, 0.00846863,
|
||||
-0.00367737, -0.00166321, 0.00045776, -0.00309753, 0.01814270, -0.00053406, 0.00256348, -0.00833130,
|
||||
-0.00312805, -0.00488281, 0.00282288, -0.00173950, 0.00004578, -0.00094604, -0.01976013, 0.00306702,
|
||||
-0.00250244, -0.00323486, 0.00154114, 0.00422668, -0.00964355, -0.01895142, 0.01704407, 0.00219727,
|
||||
-0.00090027, -0.00347900, -0.00909424, -0.00746155, -0.00656128, -0.02726746, -0.00769043, -0.00224304,
|
||||
0.00399780, 0.01086426, 0.00677490, 0.00090027, 0.00244141, -0.00988770, 0.00549316, -0.00628662,
|
||||
-0.00151062, -0.00581360, -0.00186157, -0.00430298, -0.01788330, -0.01603699, -0.03099060, -0.00659180,
|
||||
-0.00547791, -0.00958252, 0.00094604, 0.01203918, 0.00695801, 0.02105713, 0.00720215, 0.00140381,
|
||||
-0.00393677, -0.00848389, -0.01943970, -0.01473999, 0.01364136, -0.00468445, -0.00344849, 0.00566101,
|
||||
-0.00331116, -0.00723267, 0.00175476, 0.03128052, 0.00772095, -0.00163269, 0.00566101, -0.00460815,
|
||||
-0.00222778, -0.00709534, -0.00581360, 0.01132202, -0.00482178, -0.00050354, -0.01037598, -0.01887512,
|
||||
-0.00325012, -0.00445557, 0.00651550, 0.00497437, -0.01744080, 0.01000977, 0.01194763, -0.00160217,
|
||||
-0.00054932, -0.00219727, -0.00631714, -0.01139832, -0.01916504, -0.00711060, 0.00106812, -0.01481628,
|
||||
-0.00546265, 0.00070190, 0.02934265, 0.01412964, 0.00656128, 0.00003052, 0.01229858, 0.00367737,
|
||||
-0.00254822, 0.00099182, 0.02000427, -0.00164795, -0.01643372, -0.00813293, -0.00671387, -0.01013184,
|
||||
-0.00204468, 0.00265503, -0.00135803, -0.02322388, 0.00332642, 0.01715088, 0.01350403, 0.00199890,
|
||||
-0.00289917, -0.00740051, -0.01710510, -0.02655029, -0.01350403, 0.00151062, -0.00038147, 0.00778198,
|
||||
-0.00028992, 0.00064087, 0.00022888, -0.00819397, 0.00061035, 0.02536011, -0.00822449, -0.02096558,
|
||||
-0.00028992, 0.00001526, -0.00805664, -0.02310181, -0.00082397, -0.00106812, -0.02081299, -0.01762390,
|
||||
-0.00030518, 0.00170898, -0.00651550, -0.01683044, 0.00083923, -0.00955200, 0.02677917, 0.00958252,
|
||||
0.00292969, 0.00251770, -0.00447083, -0.01782227, -0.02940369, -0.02981567, 0.00372314, -0.00421143,
|
||||
0.01701355, 0.02578735, -0.00593567, 0.00595093, 0.01370239, 0.01223755, 0.00622559, -0.00111389,
|
||||
0.00061035, -0.00015259, 0.00686646, 0.00129700, -0.00637817, -0.02079773, -0.05078125, -0.01544189,
|
||||
-0.00398254, 0.00350952, 0.01591492, -0.00076294, 0.02429199, 0.02890015, 0.01559448, 0.00701904,
|
||||
-0.00177002, -0.00981140, -0.03118896, -0.01042175, -0.00013733, 0.00044250, -0.00659180, -0.01545715,
|
||||
0.00256348, 0.01017761, 0.01966858, 0.01533508, 0.01405334, 0.01646423, -0.00257874, -0.01338196,
|
||||
0.00088501, -0.00016785, -0.00163269, -0.00199890, -0.00700378, -0.00726318, -0.02569580, -0.03907776,
|
||||
0.00035095, 0.00717163, 0.00427246, 0.00279236, 0.02046204, 0.00689697, 0.02848816, 0.01043701,
|
||||
0.00041199, 0.00004578, -0.01815796, -0.03132629, -0.00378418, -0.02220154, 0.00140381, -0.00294495,
|
||||
0.01571655, 0.02601624, 0.01066589, 0.03164673, 0.03356934, 0.02770996, 0.01812744, 0.00709534,
|
||||
0.00881958, 0.02149963, 0.01010132, 0.00360107, 0.00122070, -0.00657654, -0.01893616, -0.02380371,
|
||||
-0.00672913, -0.01612854, -0.02481079, -0.00184631, 0.00761414, 0.01754761, 0.00720215, 0.01480103,
|
||||
-0.00515747, -0.01365662, -0.01542664, -0.01049805, -0.01742554, 0.02040100, -0.00880432, -0.00152588,
|
||||
-0.00303650, -0.00975037, -0.02221680, 0.01498413, 0.02423096, 0.00935364, -0.00544739, -0.00675964,
|
||||
-0.00221252, -0.00933838, -0.02006531, 0.00033569, 0.00292969, -0.01268005, -0.02940369, -0.00543213,
|
||||
-0.00231934, -0.00257874, 0.00263977, -0.00134277, -0.00151062, -0.00566101, 0.00665283, 0.03112793,
|
||||
-0.00123596, -0.00584412, -0.01034546, -0.01982117, -0.02880859, -0.02052307, -0.01663208, 0.00572205,
|
||||
0.00738525, 0.02700806, 0.01812744, 0.02203369, 0.00323486, -0.00514221, 0.01075745, 0.00660706,
|
||||
0.00349426, 0.00294495, -0.00387573, -0.01075745, -0.02171326, -0.03224182, -0.02403259, -0.02343750,
|
||||
-0.00619507, -0.01358032, -0.01676941, 0.01498413, 0.02687073, 0.02645874, 0.01818848, 0.01010132,
|
||||
-0.00459290, -0.00839233, -0.02026367, -0.02606201, 0.02151489, 0.02061462, -0.00651550, -0.00538635,
|
||||
-0.00405884, -0.00538635, 0.00645447, 0.03422546, 0.03749084, 0.02166748, 0.00497437, -0.00592041,
|
||||
-0.00209045, -0.00204468, -0.00219727, 0.00228882, 0.02597046, 0.00415039, -0.02684021, -0.01873779,
|
||||
-0.00489807, -0.00955200, -0.00572205, 0.00482178, -0.00778198, 0.01531982, 0.03317261, 0.01727295,
|
||||
-0.00341797, -0.00909424, -0.00500488, -0.00860596, -0.04263306, -0.00547791, 0.00357056, 0.00357056,
|
||||
-0.00016785, 0.01191711, 0.03486633, 0.03454590, 0.02195740, 0.01472473, 0.03034973, 0.02073669,
|
||||
-0.00109863, 0.00473022, 0.01737976, 0.00859070, -0.00253296, -0.03044128, -0.00776672, -0.01104736,
|
||||
-0.00527954, -0.00999451, -0.00939941, -0.00805664, -0.00268555, 0.04862976, 0.01870728, 0.00442505,
|
||||
-0.00317383, -0.00744629, -0.00877380, -0.02050781, -0.03236389, 0.01905823, 0.01884460, 0.00524902,
|
||||
0.00453186, 0.01782227, 0.00762939, -0.00749207, 0.03543091, 0.01852417, -0.00367737, -0.01086426,
|
||||
0.00018311, -0.00355530, -0.01539612, -0.02656555, -0.00277710, -0.01931763, -0.03083801, 0.00360107,
|
||||
-0.00143433, 0.00292969, 0.01277161, 0.00936890, 0.00128174, -0.00985718, 0.04154968, 0.02775574,
|
||||
0.00213623, 0.00561523, 0.00642395, -0.00889587, -0.03330994, -0.05546570, 0.00897217, 0.00265503,
|
||||
0.01060486, 0.05717468, 0.03829956, 0.03216553, 0.02561951, 0.02203369, 0.01969910, 0.00923157,
|
||||
0.00221252, 0.00817871, 0.01704407, -0.00007629, -0.00616455, -0.04737854, -0.03558350, 0.00561523,
|
||||
-0.00749207, -0.00627136, 0.02369690, 0.02711487, 0.03462219, 0.04241943, 0.02859497, 0.01635742,
|
||||
-0.02087402, -0.04931641, 0.00619507, 0.00404358, 0.01080322, 0.00926208, 0.00779724, 0.00225830,
|
||||
-0.00173950, 0.01293945, 0.04112244, 0.03024292, 0.03976440, 0.03063965, 0.00881958, -0.00358582,
|
||||
-0.00424194, -0.00158691, 0.02459717, 0.01078796, 0.00611877, 0.00105286, -0.02471924, -0.02410889,
|
||||
-0.00451660, -0.00415039, 0.00253296, 0.01228333, 0.02276611, 0.02371216, 0.05001831, 0.02963257,
|
||||
-0.00369263, -0.01776123, -0.03298950, -0.01219177, -0.03230286, -0.02035522, -0.01049805, -0.00700378,
|
||||
0.01309204, 0.03527832, 0.04226685, 0.04809570, 0.04991150, 0.04533386, 0.03337097, 0.01974487,
|
||||
0.00236511, 0.01925659, 0.04072571, 0.02778625, 0.01647949, -0.01173401, -0.02360535, -0.01696777,
|
||||
-0.00433350, -0.01188660, -0.02235413, 0.01066589, 0.01145935, -0.00656128, 0.02409363, 0.01565552,
|
||||
-0.00448608, -0.01176453, -0.02374268, -0.01464844, -0.01629639, -0.01852417, 0.01446533, 0.01126099,
|
||||
-0.00320435, 0.00030518, 0.00944519, 0.01014709, 0.03031921, 0.00007629, -0.00328064, 0.01599121,
|
||||
-0.00141907, -0.00477600, -0.00032043, -0.00436401, -0.00563049, -0.02128601, -0.03314209, 0.02626038,
|
||||
-0.00105286, -0.00151062, -0.00180054, -0.00811768, -0.02941895, -0.01837158, 0.03617859, 0.01126099,
|
||||
-0.00238037, -0.00828552, -0.00988770, 0.00376892, -0.02708435, -0.03489685, -0.00431824, 0.00047302,
|
||||
0.01274109, 0.02935791, 0.00981140, -0.00921631, -0.01629639, -0.00587463, 0.00247192, 0.00064087,
|
||||
0.00193787, -0.00151062, -0.00468445, -0.01261902, -0.02470398, -0.03384399, -0.04949951, -0.00338745,
|
||||
-0.00361633, -0.00816345, 0.00148010, 0.03401184, 0.01333618, 0.01911926, 0.02272034, 0.01939392,
|
||||
-0.00132751, -0.00799561, -0.02526855, -0.03221130, 0.00328064, 0.00810242, 0.00950623, 0.01345825,
|
||||
-0.00360107, -0.00260925, 0.03428650, 0.04959106, 0.01815796, 0.00881958, -0.00042725, -0.00680542,
|
||||
-0.00175476, -0.00695801, 0.00030518, 0.02726746, -0.00277710, -0.01660156, -0.02694702, -0.01084900,
|
||||
-0.00105286, 0.00723267, 0.02352905, 0.00462341, -0.01211548, 0.02276611, 0.02523804, 0.01177979,
|
||||
0.00044250, -0.00314331, -0.00833130, -0.02253723, -0.03590393, 0.00534058, -0.01576233, -0.01797485,
|
||||
0.00265503, 0.02203369, 0.05549622, 0.02410889, 0.00866699, 0.00965881, 0.00958252, -0.00190735,
|
||||
0.00163269, 0.00399780, 0.01559448, -0.00083923, -0.03933716, -0.01277161, -0.02479553, -0.01690674,
|
||||
-0.00450134, -0.00598145, -0.01719666, -0.02134705, 0.02500916, 0.02310181, 0.02972412, 0.01644897,
|
||||
-0.00181580, -0.00743103, -0.02114868, -0.03652954, -0.03193665, -0.00167847, 0.00451660, 0.00935364,
|
||||
-0.00350952, -0.00422668, -0.00115967, 0.00111389, 0.03088379, 0.04490662, -0.00390625, -0.01063538,
|
||||
0.00189209, -0.00177002, -0.01432800, -0.02612305, -0.01161194, -0.01190186, -0.04681396, -0.02130127,
|
||||
-0.00234985, -0.00527954, -0.01350403, -0.01855469, -0.00726318, -0.00196838, 0.04997253, 0.02980042,
|
||||
0.00024414, -0.00541687, -0.01794434, -0.02980042, -0.03829956, -0.04582214, 0.01480103, 0.01237488,
|
||||
0.05004883, 0.03166199, 0.02220154, 0.01562500, 0.00930786, 0.00764465, 0.00833130, 0.00251770,
|
||||
0.00430298, 0.00444031, 0.00691223, -0.00653076, -0.01719666, -0.04112244, -0.09020996, -0.00898743,
|
||||
0.00041199, 0.00929260, 0.00347900, 0.00259399, 0.05375671, 0.03878784, 0.02937317, 0.01449585,
|
||||
-0.00491333, -0.02757263, -0.06730652, -0.02465820, -0.00869751, -0.00566101, -0.00590515, 0.00354004,
|
||||
0.01916504, 0.03500366, 0.02929688, 0.03329468, 0.02725220, 0.01902771, -0.00694275, -0.01644897,
|
||||
0.00370789, 0.00387573, 0.00061035, -0.00419617, -0.01568604, -0.02262878, -0.05206299, -0.04679871,
|
||||
0.01432800, 0.03143311, 0.01612854, 0.00932312, 0.01620483, 0.02969360, 0.03417969, 0.02700806,
|
||||
0.00350952, 0.00082397, -0.03111267, -0.06707764, -0.02024841, -0.01860046, -0.00958252, -0.00173950,
|
||||
0.05522156, 0.04231262, 0.04219055, 0.03793335, 0.03443909, 0.03150940, 0.02209473, 0.01277161,
|
||||
0.03974915, 0.03291321, 0.01431274, 0.00024414, 0.00086975, -0.01142883, -0.03588867, -0.01281738,
|
||||
-0.00840759, -0.02593994, -0.04820251, 0.00361633, 0.01782227, 0.03044128, 0.02810669, 0.02386475,
|
||||
-0.00660706, -0.02162170, -0.03446960, -0.01261902, -0.02426147, 0.01382446, 0.01550293, 0.01689148,
|
||||
-0.00529480, -0.00663757, -0.01538086, -0.00068665, 0.05569458, 0.01844788, 0.00303650, 0.00178528,
|
||||
-0.00257874, -0.00895691, -0.00971985, -0.00666809, 0.00314331, -0.00125122, -0.05572510, 0.00030518,
|
||||
-0.00048828, 0.00041199, -0.00028992, -0.00938416, -0.00831604, -0.03677368, 0.01962280, 0.03395081,
|
||||
0.00151062, -0.00248718, -0.01004028, -0.02021790, -0.03338623, -0.05041504, -0.02108765, 0.00358582,
|
||||
0.01791382, 0.06657410, 0.02952576, 0.01698303, 0.00154114, -0.00361633, 0.00166321, -0.00538635,
|
||||
0.00483704, 0.01110840, 0.01173401, -0.00868225, -0.03361511, -0.06233215, -0.03771973, -0.02009583,
|
||||
-0.00576782, -0.01533508, -0.01855469, 0.03782654, 0.04870605, 0.04002380, 0.02944946, 0.01617432,
|
||||
-0.00526428, -0.01495361, -0.03617859, -0.05659485, 0.00096130, 0.01994324, 0.01362610, 0.00981140,
|
||||
-0.00202942, -0.00065613, 0.02978516, 0.07008362, 0.05216980, 0.03585815, 0.01889038, 0.00332642,
|
||||
-0.00016785, 0.00070190, 0.00903320, 0.03486633, 0.03285217, 0.00875854, -0.03100586, -0.03533936,
|
||||
-0.00460815, -0.00889587, -0.00535583, -0.00605774, -0.01533508, 0.03904724, 0.05235291, 0.02601624,
|
||||
0.00132751, -0.00230408, -0.00685120, -0.03175354, -0.06939697, -0.02249146, -0.01206970, -0.00375366,
|
||||
-0.00267029, 0.01330566, 0.07746887, 0.05206299, 0.03462219, 0.02912903, 0.02680969, 0.01100159,
|
||||
0.00160217, 0.01959229, 0.05360413, 0.01110840, -0.02023315, -0.03753662, -0.01402283, -0.01716614,
|
||||
-0.00639343, -0.01054382, -0.00729370, 0.00303650, 0.02307129, 0.07855225, 0.04028320, 0.01892090,
|
||||
-0.00352478, -0.01866150, -0.02894592, -0.03585815, -0.06474304, -0.00245667, 0.02102661, 0.01512146,
|
||||
-0.00077820, 0.01048279, 0.01577759, 0.02217102, 0.07875061, 0.04440308, 0.00306702, -0.00975037,
|
||||
0.00099182, -0.01753235, -0.02914429, -0.03764343, -0.03930664, -0.04081726, -0.06845093, -0.01873779,
|
||||
-0.00256348, -0.00033569, 0.00053406, 0.00070190, -0.00105286, 0.00088501, 0.08264160, 0.03260803,
|
||||
0.00869751, 0.00711060, -0.00775146, -0.03376770, -0.06314087, -0.08934021, -0.01795959, 0.00088501,
|
||||
0.02838135, 0.09507751, 0.06649780, 0.05419922, 0.04470825, 0.03926086, 0.02592468, 0.01179504,
|
||||
0.04316711, 0.05152893, 0.01130676, -0.02204895, -0.04406738, -0.06632996, -0.08439636, -0.05546570,
|
||||
-0.00311279, 0.00325012, 0.02406311, 0.04458618, 0.07960510, 0.07987976, 0.04357910, 0.01593018,
|
||||
-0.02593994, -0.07890320, -0.02648926, -0.02957153, -0.01586914, -0.01681519, -0.00686646, -0.00469971,
|
||||
0.00602722, 0.03062439, 0.07060242, 0.06431580, 0.04623413, 0.02545166, -0.00128174, -0.01522827,
|
||||
0.00640869, 0.01506042, 0.02645874, 0.01609802, 0.00148010, -0.01939392, -0.05572510, -0.06500244,
|
||||
-0.00239563, 0.00444031, 0.01907349, 0.03089905, 0.03352356, 0.05075073, 0.07539368, 0.03486633,
|
||||
-0.00079346, -0.03021240, -0.05854797, -0.07080078, -0.06494141, -0.05015564, -0.02285767, -0.00508118,
|
||||
0.00588989, 0.03402710, 0.08795166, 0.09323120, 0.07124329, 0.05776978, 0.03340149, 0.01075745,
|
||||
0.02717590, 0.07472229, 0.08680725, 0.03575134, 0.00018311, -0.03523254, -0.05368042, -0.04931641
|
||||
};
|
||||
|
||||
/* spec */
|
||||
const Float bv32_lspecb21[] =
|
||||
{
|
||||
0.00281525, 0.00292778, 0.00433731,
|
||||
-0.00021553, -0.00037766, -0.00252151,
|
||||
0.00709152, -0.00558853, -0.00040245,
|
||||
-0.00341034, -0.00456047, 0.00535393,
|
||||
-0.00196075, 0.00144005, 0.01340103,
|
||||
-0.00179482, -0.00482559, -0.00926208,
|
||||
-0.00576019, 0.00680923, 0.00318718,
|
||||
-0.00498390, -0.01045990, -0.00181580,
|
||||
0.00724030, 0.00892258, -0.00010681,
|
||||
-0.00100517, 0.00750542, -0.01124763,
|
||||
0.01622772, 0.00503349, -0.00928497,
|
||||
-0.01317978, -0.00148201, -0.00485039,
|
||||
0.00139236, 0.01294518, 0.01284790,
|
||||
0.00160599, -0.00276566, -0.02051735,
|
||||
0.00048065, 0.02153206, -0.00239372,
|
||||
0.00121498, -0.01841927, 0.00706482,
|
||||
0.01221657, 0.00114632, 0.01258469,
|
||||
0.00564766, 0.00059319, -0.00907707,
|
||||
0.02144051, -0.01291847, -0.00042725,
|
||||
-0.01160431, -0.01168442, 0.01208878,
|
||||
-0.00497437, -0.00429916, 0.02562332,
|
||||
-0.00357437, -0.01308441, -0.01529694,
|
||||
-0.01611328, 0.01459503, 0.00725365,
|
||||
-0.01193810, -0.02121544, -0.00399017,
|
||||
0.01710129, 0.01618958, 0.00624657,
|
||||
0.00753784, 0.01832008, -0.02398491,
|
||||
0.03960609, 0.01548195, -0.00556374,
|
||||
-0.03484535, 0.00230217, 0.00053406,
|
||||
-0.00045013, 0.01565170, 0.03667641,
|
||||
-0.00150681, -0.01651573, -0.03601646,
|
||||
0.00778198, 0.04269028, 0.00644302,
|
||||
-0.01263237, -0.04002953, 0.00638008
|
||||
};
|
||||
|
||||
/* spec */
|
||||
const Float bv32_lspecb22[] =
|
||||
{
|
||||
0.00223160, -0.00800133, -0.00899124, 0.00006485, 0.00058365,
|
||||
0.00498199, 0.00384903, -0.00713539, -0.00961494, -0.00307274,
|
||||
-0.00000954, 0.00230217, 0.00827026, 0.00367355, 0.00186920,
|
||||
0.00362587, 0.01415634, 0.00111580, 0.00265884, -0.00458145,
|
||||
-0.01116562, 0.00059700, -0.01137161, 0.00316811, -0.00823975,
|
||||
0.00366402, 0.00034904, -0.00654984, 0.00271797, -0.01940155,
|
||||
-0.00282288, -0.00809288, 0.00408554, -0.00595474, -0.00964355,
|
||||
0.01284599, 0.00154495, 0.00731087, 0.00330925, -0.00998116,
|
||||
-0.00849152, -0.00714302, 0.00018120, 0.00532913, 0.00732613,
|
||||
-0.00639915, 0.00654030, -0.00492859, -0.00344276, 0.01243401,
|
||||
-0.00438499, 0.00685120, -0.00248146, 0.01663589, 0.00031281,
|
||||
0.01028252, 0.00627327, -0.00315285, 0.00683403, 0.00990868,
|
||||
-0.01620674, 0.00895309, 0.00953102, 0.00367737, -0.00362778,
|
||||
-0.00172234, 0.00682259, 0.00998497, -0.01184273, 0.00318718,
|
||||
-0.00300217, -0.00821686, 0.00954819, 0.01287270, -0.00807762,
|
||||
0.01217651, -0.00773621, 0.00847435, -0.00031281, 0.00645638,
|
||||
-0.00471497, -0.01052666, -0.02195930, -0.01058769, 0.00412560,
|
||||
0.00894547, -0.00356674, -0.00493240, -0.02550888, -0.00962448,
|
||||
-0.00122452, 0.00730324, 0.01606369, 0.01205063, 0.01569366,
|
||||
-0.00556946, 0.02675247, -0.00582695, -0.00326729, 0.00189209,
|
||||
-0.01784134, 0.00078583, -0.00429535, -0.01312637, -0.00244522,
|
||||
-0.00508881, 0.00965881, 0.00708389, -0.01148987, -0.02126884,
|
||||
-0.00472450, -0.01339912, 0.00592613, -0.01262474, 0.00816154,
|
||||
0.02260780, 0.01769447, 0.00827408, -0.00707054, -0.00349998,
|
||||
-0.00877571, -0.00870895, -0.01420212, 0.01482201, 0.01783562,
|
||||
0.00730515, 0.00027847, -0.00198555, -0.01367950, 0.02097321,
|
||||
0.00929070, -0.00706673, -0.00564384, 0.01904678, 0.00018692,
|
||||
0.01049805, 0.01000977, -0.02177620, 0.00494194, 0.00013351,
|
||||
-0.02701187, -0.01168251, 0.01052856, 0.00321388, 0.00094223,
|
||||
0.00286293, -0.00534248, 0.02644157, -0.00658035, -0.00415039,
|
||||
0.00362587, -0.02618980, 0.00177765, 0.00383186, -0.00398064,
|
||||
0.02854538, -0.00962830, -0.00597000, -0.00085640, -0.00148964
|
||||
};
|
||||
|
||||
/* spec */
|
||||
const Float bv32_lspmean[] = /* mean value of LSP components */
|
||||
{
|
||||
0.0551453,
|
||||
0.1181030,
|
||||
0.2249756,
|
||||
0.3316040,
|
||||
0.4575806,
|
||||
0.5720825,
|
||||
0.7193298,
|
||||
0.8278198
|
||||
};
|
||||
|
||||
/* spec */
|
||||
const Float bv32_lspp[] = /* LSP Predictor Coefficients */
|
||||
{
|
||||
0.7401123, 0.6939697, 0.6031494, 0.5333862, 0.4295044, 0.3234253, 0.2177124, 0.1162720,
|
||||
0.7939453, 0.7693481, 0.6712036, 0.5919189, 0.4750366, 0.3556519, 0.2369385, 0.1181030,
|
||||
0.7534180, 0.7318115, 0.6326294, 0.5588379, 0.4530029, 0.3394775, 0.2307739, 0.1201172,
|
||||
0.7188110, 0.6765747, 0.5792847, 0.5169067, 0.4223022, 0.3202515, 0.2235718, 0.1181030,
|
||||
0.6431885, 0.6023560, 0.5112305, 0.4573364, 0.3764038, 0.2803345, 0.2060547, 0.1090698,
|
||||
0.5687866, 0.5837402, 0.4616089, 0.4351196, 0.3502808, 0.2602539, 0.1951294, 0.0994263,
|
||||
0.5292969, 0.4835205, 0.3890381, 0.3581543, 0.2882080, 0.2261353, 0.1708984, 0.0941162,
|
||||
0.5134277, 0.4365845, 0.3521729, 0.3118896, 0.2514038, 0.1951294, 0.1443481, 0.0841064
|
||||
};
|
||||
|
||||
/* spec */
|
||||
const Float bv32_lgpecb[] = /* Log-Gain Prediction Error CodeBook */
|
||||
{
|
||||
-4.91895,
|
||||
-3.75049,
|
||||
-3.09082,
|
||||
-2.59961,
|
||||
-2.22656,
|
||||
-1.46240,
|
||||
-0.88037,
|
||||
-0.34717,
|
||||
-1.93408,
|
||||
-1.25635,
|
||||
-0.70117,
|
||||
-0.16650,
|
||||
0.20361,
|
||||
0.82568,
|
||||
1.59863,
|
||||
2.75684,
|
||||
-1.68457,
|
||||
-1.06299,
|
||||
-0.52588,
|
||||
0.01563,
|
||||
0.39941,
|
||||
1.05664,
|
||||
1.91602,
|
||||
3.34326,
|
||||
0.60693,
|
||||
1.31201,
|
||||
2.29736,
|
||||
4.11426,
|
||||
5.20996,
|
||||
6.70410,
|
||||
8.74316,
|
||||
10.92188
|
||||
};
|
||||
|
||||
/* spec */
|
||||
const Float bv32_lgp[] = /* Log-Gain Predictor */
|
||||
{
|
||||
0.5913086,
|
||||
0.5251160,
|
||||
0.5724792,
|
||||
0.5977783,
|
||||
0.4800720,
|
||||
0.4939270,
|
||||
0.4729614,
|
||||
0.4158936,
|
||||
0.3805847,
|
||||
0.3395081,
|
||||
0.2780151,
|
||||
0.2455139,
|
||||
0.1916199,
|
||||
0.1470032,
|
||||
0.1138611,
|
||||
0.0664673
|
||||
};
|
||||
|
||||
/* spec */
|
||||
const Float bv32_lgmean = 11.82031;
|
||||
|
||||
/* spec */
|
||||
const Float bv32_cccb[] =
|
||||
{
|
||||
-0.537476, 0.974976, -0.631104, -0.617920,
|
||||
1.145142, 1.222534, -1.252441, 0.616211,
|
||||
1.174194, 1.399414, 0.330933, 0.823120,
|
||||
2.946899, 0.798096, -0.274658, -0.027344,
|
||||
-1.704102, 0.098755, -0.526001, -0.395508,
|
||||
-0.889038, -0.337402, 0.784546, 0.298462,
|
||||
-0.756958, -0.061890, 0.558960, -0.907227,
|
||||
1.373169, -0.413330, 0.690552, -0.794067,
|
||||
-0.573364, -0.463745, -0.606934, -0.623535,
|
||||
1.058716, -0.566040, -1.677246, 0.752563,
|
||||
0.432617, 0.441895, -0.630493, -1.445801,
|
||||
2.542358, 0.207031, -1.611450, 0.313354,
|
||||
-2.572266, -2.758423, -0.499390, -0.020142,
|
||||
0.432251, -2.303711, -2.016479, 0.228638,
|
||||
0.701538, -1.355591, -0.861572, -0.243042,
|
||||
0.857056, -1.842285, -0.006348, 1.216919,
|
||||
-1.474365, 1.636108, -0.683838, 0.362915,
|
||||
-0.361694, 0.711914, -0.136353, 1.619873,
|
||||
0.407104, 1.661255, 0.566406, -0.559937,
|
||||
1.670288, 1.159668, 1.760254, 0.524780,
|
||||
-1.860596, 0.592285, 1.213379, 0.719482,
|
||||
-0.845703, 0.081421, 2.197754, 1.654785,
|
||||
0.425415, 0.641357, 1.210205, -1.444580,
|
||||
0.208374, 0.481567, 1.808472, 0.685913,
|
||||
-1.022583, 0.425781, -0.168945, -1.642700,
|
||||
0.502075, -0.491455, -0.296631, -0.068359,
|
||||
0.270630, 0.005981, 0.257813, -0.466309,
|
||||
2.266357, -1.128540, -0.399414, 0.438477,
|
||||
-1.876343, -0.895142, -0.012207, 0.886841,
|
||||
-0.389771, -1.818604, 1.185791, 0.913452,
|
||||
-0.040771, -1.141968, 0.364258, -0.283691,
|
||||
0.448242, -0.755127, 1.767578, -0.691406
|
||||
};
|
||||
|
||||
const Float bv32_pp9cb[] =
|
||||
{
|
||||
-2.9005200e-001, 5.9857400e-001, 2.8242800e-001, 8.6808793e-002,
|
||||
-8.4527029e-002, 4.0959403e-002, -2.1032541e-002, -8.9572708e-002,
|
||||
-1.9941394e-002,
|
||||
-2.5773600e-001, 1.3779820e+000, 8.1913200e-001, 1.7757778e-001,
|
||||
-5.6437458e-001, 1.0555990e-001, -1.6606961e-002, -4.7470860e-001,
|
||||
-1.6774431e-001,
|
||||
-6.8988000e-002, 4.0204400e-001, 2.3288400e-001, 1.3868106e-002,
|
||||
-4.6814807e-002, 8.0331007e-003, -1.1898360e-003, -4.0409844e-002,
|
||||
-1.3558739e-002,
|
||||
-1.0210000e-002, 1.0048600e+000, 7.7118200e-001, 5.1298103e-003,
|
||||
-3.8746497e-001, 3.9368841e-003, -2.6061025e-005, -2.5243590e-001,
|
||||
-1.4868042e-001,
|
||||
-1.1636000e-002, 5.6408400e-001, 1.0782800e-001, 3.2818407e-003,
|
||||
-3.0412025e-002, 6.2734330e-004, -3.3849124e-005, -7.9547690e-002,
|
||||
-2.9067194e-003,
|
||||
4.8679200e-001, 8.9901600e-001, 5.7433200e-001, -2.1881690e-001,
|
||||
-2.5816683e-001, -1.3979011e-001, -5.9241613e-002, -2.0205744e-001,
|
||||
-8.2464312e-002,
|
||||
-1.3678200e-001, -4.6110800e-001, 1.5254600e-001, -3.1535637e-002,
|
||||
3.5170090e-002, 1.0432773e-002, -4.6773289e-003, -5.3155147e-002,
|
||||
-5.8175705e-003,
|
||||
4.1686000e-002, 6.4152800e-001, 4.3733400e-001, -1.3371368e-002,
|
||||
-1.4028100e-001, -9.1153526e-003, -4.3443065e-004, -1.0288954e-001,
|
||||
-4.7815257e-002,
|
||||
1.6641000e-001, 6.6628800e-001, 4.2048000e-002, -5.5438493e-002,
|
||||
-1.4008039e-002, -3.4986038e-003, -6.9230720e-003, -1.1098492e-001,
|
||||
-4.4200858e-004,
|
||||
2.3891400e-001, 1.2416060e+000, 4.7916200e-001, -1.4831853e-001,
|
||||
-2.9746521e-001, -5.7239255e-002, -1.4269975e-002, -3.8539636e-001,
|
||||
-5.7399056e-002,
|
||||
1.5663800e-001, 3.7065800e-001, 1.8346800e-001, -2.9029564e-002,
|
||||
-3.4001941e-002, -1.4369030e-002, -6.1338658e-003, -3.4346838e-002,
|
||||
-8.4151268e-003,
|
||||
3.2286400e-001, 8.4265000e-001, 6.6942000e-001, -1.3603067e-001,
|
||||
-2.8204338e-001, -1.0806581e-001, -2.6060291e-002, -1.7751476e-001,
|
||||
-1.1203078e-001,
|
||||
3.4039200e-001, 4.8907800e-001, 9.7528000e-002, -8.3239119e-002,
|
||||
-2.3849400e-002, -1.6598875e-002, -2.8966678e-002, -5.9799323e-002,
|
||||
-2.3779277e-003,
|
||||
6.8932600e-001, 9.7475400e-001, 2.9750200e-001, -3.3596164e-001,
|
||||
-1.4499563e-001, -1.0253793e-001, -1.1879258e-001, -2.3753634e-001,
|
||||
-2.2126860e-002,
|
||||
2.3204200e-001, -4.9914600e-001, 1.4655400e-001, 5.7911418e-002,
|
||||
3.6575921e-002, -1.7003342e-002, -1.3460872e-002, -6.2286682e-002,
|
||||
-5.3695187e-003,
|
||||
5.7895600e-001, 6.7697000e-001, 4.8903800e-001, -1.9596792e-001,
|
||||
-1.6553203e-001, -1.4156574e-001, -8.3797512e-002, -1.1457210e-001,
|
||||
-5.9789541e-002,
|
||||
-2.6667800e-001, 6.9637800e-001, -1.3954600e-001, 9.2854346e-002,
|
||||
4.8588382e-002, -1.8606924e-002, -1.7779289e-002, -1.2123558e-001,
|
||||
-4.8682715e-003,
|
||||
-1.7600000e-002, 1.6969620e+000, 2.8014800e-001, 1.4933266e-002,
|
||||
-2.3770026e-001, 2.4653024e-003, -7.7440000e-005, -7.1992001e-001,
|
||||
-1.9620725e-002,
|
||||
-1.6124400e-001, 4.1076200e-001, -3.2358000e-002, 3.3116454e-002,
|
||||
6.6457184e-003, -2.6087667e-003, -6.4999069e-003, -4.2181355e-002,
|
||||
-2.6176004e-004,
|
||||
-6.6390000e-002, 9.5376600e-001, 2.3754200e-001, 3.1660262e-002,
|
||||
-1.1327974e-001, 7.8852067e-003, -1.1019080e-003, -2.2741740e-001,
|
||||
-1.4106550e-002,
|
||||
3.8460000e-003, 5.3013600e-001, -2.6145400e-001, -1.0194515e-003,
|
||||
6.9303089e-002, 5.0277604e-004, -3.6979290e-006, -7.0261045e-002,
|
||||
-1.7089549e-002,
|
||||
4.3861400e-001, 1.4447380e+000, 6.2326000e-002, -3.1684116e-001,
|
||||
-4.5022370e-002, -1.3668528e-002, -4.8095560e-002, -5.2181697e-001,
|
||||
-9.7113257e-004,
|
||||
1.5442000e-002, 1.4250800e-001, 2.5232000e-002, -1.1003043e-003,
|
||||
-1.7978809e-003, -1.9481627e-004, -5.9613841e-005, -5.0771325e-003,
|
||||
-1.5916346e-004,
|
||||
2.9463000e-001, 5.2297600e-001, 3.5731600e-001, -7.7042209e-002,
|
||||
-9.3433846e-002, -5.2638007e-002, -2.1701709e-002, -6.8375974e-002,
|
||||
-3.1918681e-002,
|
||||
2.6816800e-001, 9.2876800e-001, -2.0899000e-001, -1.2453293e-001,
|
||||
9.7051612e-002, 2.8022215e-002, -1.7978519e-002, -2.1565250e-001,
|
||||
-1.0919205e-002,
|
||||
8.3488800e-001, 1.3611020e+000, -2.3238000e-001, -5.6818386e-001,
|
||||
1.5814644e-001, 9.7005637e-002, -1.7425949e-001, -4.6314966e-001,
|
||||
-1.3500116e-002,
|
||||
1.2479600e-001, 3.8813600e-001, -5.9852000e-002, -2.4218910e-002,
|
||||
1.1615358e-002, 3.7346451e-003, -3.8935104e-003, -3.7662389e-002,
|
||||
-8.9556548e-004,
|
||||
3.3026200e-001, 8.9619600e-001, 2.9964600e-001, -1.4798974e-001,
|
||||
-1.3427077e-001, -4.9480844e-002, -2.7268247e-002, -2.0079182e-001,
|
||||
-2.2446931e-002,
|
||||
3.2806200e-001, 5.4098200e-001, -2.0613400e-001, -8.8737818e-002,
|
||||
5.5757392e-002, 3.3812366e-002, -2.6906169e-002, -7.3165381e-002,
|
||||
-1.0622806e-002,
|
||||
7.7764400e-001, 1.0285520e+000, -4.9966000e-002, -3.9992365e-001,
|
||||
2.5696315e-002, 1.9427880e-002, -1.5118255e-001, -2.6447980e-001,
|
||||
-6.2415029e-004,
|
||||
8.2660000e-003, -4.3842200e-001, -1.6479000e-001, 1.8119981e-003,
|
||||
-3.6123781e-002, 6.8107707e-004, -1.7081689e-005, -4.8053463e-002,
|
||||
-6.7889360e-003,
|
||||
5.4489000e-001, 7.3032400e-001, 1.0464600e-001, -1.9897312e-001,
|
||||
-3.8212743e-002, -2.8510279e-002, -7.4226278e-002, -1.3334329e-001,
|
||||
-2.7376963e-003
|
||||
};
|
||||
|
||||
/* Pre-Emphasis or De-Emphasis Filter */
|
||||
const Float bv32_a_pre[] = { 1.0, PEAPFC };
|
||||
const Float bv32_b_pre[] = { 1.0, PEAZFC };
|
||||
|
||||
/* Combined High-Pass & Pre-Emphasis Filter */
|
||||
const Float bv32_hpfa[] = {1.00000000000000, PEAPFC-(127./128), PEAPFC*(-127./128)};
|
||||
const Float bv32_hpfb[] = {255./256, 255./256*(PEAZFC-1.), -255./256*PEAZFC};
|
||||
|
||||
/* spec */
|
||||
/* coarse pitch search */
|
||||
const Float bv32_adf[] =
|
||||
{
|
||||
1.00000000000000,
|
||||
-3.56023061648011,
|
||||
4.85584780946374,
|
||||
-2.99882978945971,
|
||||
0.70692772790790
|
||||
};
|
||||
|
||||
/* spec */
|
||||
const Float bv32_bdf[] =
|
||||
{
|
||||
0.0322952,
|
||||
-0.1028824,
|
||||
0.1446838,
|
||||
-0.1028824,
|
||||
0.0322952
|
||||
};
|
||||
|
||||
const Float bv32_x[] = {0.125, 0.25, 0.375, 0.5};
|
||||
const Float bv32_x2[] = {0.015625, 0.0625, 0.140625, 0.25}; /* square of x[] */
|
||||
const Float bv32_MPTH[] = {0.7, 0.55, 0.48, 0.37};
|
||||
|
||||
/* spec */
|
||||
const Float bv32_winl[] =
|
||||
{
|
||||
0.0001831,
|
||||
0.0006714,
|
||||
0.0015259,
|
||||
0.0026855,
|
||||
0.0042114,
|
||||
0.0060425,
|
||||
0.0082397,
|
||||
0.0107422,
|
||||
0.0135803,
|
||||
0.0167542,
|
||||
0.0202637,
|
||||
0.0240784,
|
||||
0.0281982,
|
||||
0.0326843,
|
||||
0.0374451,
|
||||
0.0425110,
|
||||
0.0479126,
|
||||
0.0536194,
|
||||
0.0596008,
|
||||
0.0659180,
|
||||
0.0725098,
|
||||
0.0793762,
|
||||
0.0865479,
|
||||
0.0939636,
|
||||
0.1016846,
|
||||
0.1096497,
|
||||
0.1179199,
|
||||
0.1264038,
|
||||
0.1351624,
|
||||
0.1441650,
|
||||
0.1534119,
|
||||
0.1628723,
|
||||
0.1725769,
|
||||
0.1824951,
|
||||
0.1926270,
|
||||
0.2029724,
|
||||
0.2135010,
|
||||
0.2242432,
|
||||
0.2351685,
|
||||
0.2462769,
|
||||
0.2575378,
|
||||
0.2689514,
|
||||
0.2805481,
|
||||
0.2922974,
|
||||
0.3041687,
|
||||
0.3161926,
|
||||
0.3283081,
|
||||
0.3405762,
|
||||
0.3529053,
|
||||
0.3653870,
|
||||
0.3779297,
|
||||
0.3905334,
|
||||
0.4032593,
|
||||
0.4160156,
|
||||
0.4288330,
|
||||
0.4417114,
|
||||
0.4546204,
|
||||
0.4675598,
|
||||
0.4805298,
|
||||
0.4934998,
|
||||
0.5065002,
|
||||
0.5194702,
|
||||
0.5324402,
|
||||
0.5453796,
|
||||
0.5582886,
|
||||
0.5711670,
|
||||
0.5839844,
|
||||
0.5967407,
|
||||
0.6094666,
|
||||
0.6220703,
|
||||
0.6346130,
|
||||
0.6470947,
|
||||
0.6594238,
|
||||
0.6716919,
|
||||
0.6838074,
|
||||
0.6958313,
|
||||
0.7077026,
|
||||
0.7194519,
|
||||
0.7310486,
|
||||
0.7424622,
|
||||
0.7537231,
|
||||
0.7648315,
|
||||
0.7757568,
|
||||
0.7864990,
|
||||
0.7970276,
|
||||
0.8073730,
|
||||
0.8175049,
|
||||
0.8274231,
|
||||
0.8371277,
|
||||
0.8465881,
|
||||
0.8558350,
|
||||
0.8648376,
|
||||
0.8735962,
|
||||
0.8820801,
|
||||
0.8903503,
|
||||
0.8983154,
|
||||
0.9060364,
|
||||
0.9134521,
|
||||
0.9206238,
|
||||
0.9274902,
|
||||
0.9340820,
|
||||
0.9403992,
|
||||
0.9463806,
|
||||
0.9520874,
|
||||
0.9574890,
|
||||
0.9625549,
|
||||
0.9673157,
|
||||
0.9718018,
|
||||
0.9759216,
|
||||
0.9797363,
|
||||
0.9832458,
|
||||
0.9864197,
|
||||
0.9892578,
|
||||
0.9917603,
|
||||
0.9939575,
|
||||
0.9957886,
|
||||
0.9973145,
|
||||
0.9984741,
|
||||
0.9993286,
|
||||
0.9998169,
|
||||
1.0000000,
|
||||
0.9992371,
|
||||
0.9969177,
|
||||
0.9930725,
|
||||
0.9877014,
|
||||
0.9807739,
|
||||
0.9723816,
|
||||
0.9624634,
|
||||
0.9510498,
|
||||
0.9382019,
|
||||
0.9238892,
|
||||
0.9081421,
|
||||
0.8910217,
|
||||
0.8724976,
|
||||
0.8526306,
|
||||
0.8314819,
|
||||
0.8090210,
|
||||
0.7853088,
|
||||
0.7604065,
|
||||
0.7343140,
|
||||
0.7070923,
|
||||
0.6788025,
|
||||
0.6494446,
|
||||
0.6190796,
|
||||
0.5877991,
|
||||
0.5555725,
|
||||
0.5224915,
|
||||
0.4886169,
|
||||
0.4539795,
|
||||
0.4186707,
|
||||
0.3826904,
|
||||
0.3461304,
|
||||
0.3090210,
|
||||
0.2714539,
|
||||
0.2334595,
|
||||
0.1950989,
|
||||
0.1564331,
|
||||
0.1175232,
|
||||
0.0784607,
|
||||
0.0392456
|
||||
};
|
||||
|
||||
/* spec */
|
||||
const Float bv32_sstwin[] =
|
||||
{
|
||||
1.00003162253432,
|
||||
0.99950664035278,
|
||||
0.99802802494523,
|
||||
0.99556852541705,
|
||||
0.99213540445135,
|
||||
0.98773878305059,
|
||||
0.98239158372414,
|
||||
0.97610947553847,
|
||||
0.96891079029551
|
||||
};
|
||||
|
||||
const int bv32_idxord[] =
|
||||
{
|
||||
0, 1, 2, 3, 4, 8, 16, 5, 9, 17, 6, 10, 18, 7, 11, 19,
|
||||
12, 20, 24, 13, 21, 25, 14, 22, 26, 15, 23, 27, 28, 29, 30, 31
|
||||
};
|
||||
|
||||
/* spec */
|
||||
const Float bv32_lgpecb_nh[] = /* Log-Gain Prediction Error Next-Higher CodeBook */
|
||||
{
|
||||
-3.75049,
|
||||
-3.09082,
|
||||
-2.59961,
|
||||
-2.22656,
|
||||
-1.93408,
|
||||
-1.25635,
|
||||
-0.70117,
|
||||
-0.16650,
|
||||
-1.68457,
|
||||
-1.06299,
|
||||
-0.52588,
|
||||
0.01563,
|
||||
0.39941,
|
||||
1.05664,
|
||||
1.91602,
|
||||
3.34326,
|
||||
-1.46240,
|
||||
-0.88037,
|
||||
-0.34717,
|
||||
0.20361,
|
||||
0.60693,
|
||||
1.31201,
|
||||
2.29736,
|
||||
4.11426,
|
||||
0.82568,
|
||||
1.59863,
|
||||
2.75684,
|
||||
5.20996,
|
||||
6.70410,
|
||||
8.74316,
|
||||
10.92188
|
||||
};
|
|
@ -1,261 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* a2lsp.c -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: a2lsp.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "typedef.h"
|
||||
#include "bvcommon.h"
|
||||
|
||||
#define PI 3.14159265358979
|
||||
|
||||
#define NAB ((LPCO >> 1) + 1)
|
||||
|
||||
static Float FNevChebP(Float x, Float *c, int nd2);
|
||||
|
||||
#define NBIS 4 /* number of bisections */
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* a2lsp - Convert predictor coefficients to line spectral pairs
|
||||
*
|
||||
* Description:
|
||||
* The transfer function of the prediction error filter is formed from the
|
||||
* predictor coefficients. This polynomial is transformed into two reciprocal
|
||||
* polynomials having roots on the unit circle. The roots of these polynomials
|
||||
* interlace. It is these roots that determine the line spectral pairs.
|
||||
* The two reciprocal polynomials are expressed as series expansions in
|
||||
* Chebyshev polynomials with roots in the range -1 to +1. The inverse cosine
|
||||
* of the roots of the Chebyshev polynomial expansion gives the line spectral
|
||||
* pairs. If np line spectral pairs are not found, this routine
|
||||
* stops with an error message. This error occurs if the input coefficients
|
||||
* do not give a prediction error filter with minimum phase.
|
||||
*
|
||||
* Line spectral pairs and predictor coefficients are usually expressed
|
||||
* algebraically as vectors.
|
||||
* lsp[0] first (lowest frequency) line spectral pair
|
||||
* lsp[i] 1 <= i < np
|
||||
* pc[0]=1.0 predictor coefficient corresponding to lag 0
|
||||
* pc[i] 1 <= 1 <= np
|
||||
*
|
||||
* Parameters:
|
||||
* -> Float pc[]
|
||||
* Vector of predictor coefficients (Np+1 values). These are the
|
||||
* coefficients of the predictor filter, with pc[0] being the predictor
|
||||
* coefficient corresponding to lag 0, and pc[Np] corresponding to lag Np.
|
||||
* The predictor coeffs. must correspond to a minimum phase prediction
|
||||
* error filter.
|
||||
* <- Float lsp[]
|
||||
* Array of Np line spectral pairss (in ascending order). Each line
|
||||
* spectral pair lies in the range 0 to pi.
|
||||
* -> int Np
|
||||
* Number of coefficients (at most LPCO = 50)
|
||||
*----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void a2lsp(Float pc[], /* (i) input the np+1 predictor coeff. */
|
||||
Float lsp[], /* (o) line spectral pairs */
|
||||
Float old_lsp[]) /* (i/o) old lsp[] (in case not found 10 roots) */
|
||||
{
|
||||
Float fa[NAB], fb[NAB];
|
||||
Float ta[NAB], tb[NAB];
|
||||
Float *t;
|
||||
Float xlow, xmid, xhigh;
|
||||
Float ylow, ymid, yhigh;
|
||||
Float xroot;
|
||||
Float dx;
|
||||
int i, j, nf, nd2, nab = ((LPCO>>1) + 1), ngrd;
|
||||
|
||||
fb[0] = fa[0] = 1.0;
|
||||
for (i = 1, j = LPCO; i <= (LPCO/2); i++, j--)
|
||||
{
|
||||
fa[i] = pc[i] + pc[j] - fa[i-1];
|
||||
fb[i] = pc[i] - pc[j] + fb[i-1];
|
||||
}
|
||||
|
||||
nd2 = LPCO/2;
|
||||
|
||||
/*
|
||||
* To look for roots on the unit circle, Ga(D) and Gb(D) are evaluated for
|
||||
* D=exp(jw). Since Gz(D) and Gb(D) are symmetric, they can be expressed in
|
||||
* terms of a series in cos(nw) for D on the unit circle. Since M is odd and
|
||||
* D=exp(jw)
|
||||
*
|
||||
* M-1 n
|
||||
* Ga(D) = SUM fa(n) D (symmetric, fa(n) = fa(M-1-n))
|
||||
* n=0
|
||||
* Mh-1
|
||||
* = exp(j Mh w) [ f1(Mh) + 2 SUM fa(n) cos((Mh-n)w) ]
|
||||
* n=0
|
||||
* Mh
|
||||
* = exp(j Mh w) SUM ta(n) cos(nw),
|
||||
* n=0
|
||||
*
|
||||
* where Mh=(M-1)/2=Nc-1. The Nc=Mh+1 coefficients ta(n) are defined as
|
||||
*
|
||||
* ta(n) = fa(Nc-1), n=0,
|
||||
* = 2 fa(Nc-1-n), n=1,...,Nc-1.
|
||||
* The next step is to identify cos(nw) with the Chebyshev polynomial T(n,x).
|
||||
* The Chebyshev polynomials satisfy the relationship T(n,cos(w)) = cos(nw).
|
||||
* Omitting the exponential delay term, the series expansion in terms of
|
||||
* Chebyshev polynomials is
|
||||
*
|
||||
* Nc-1
|
||||
* Ta(x) = SUM ta(n) T(n,x)
|
||||
* n=0
|
||||
*
|
||||
* The domain of Ta(x) is -1 < x < +1. For a given root of Ta(x), say x0,
|
||||
* the corresponding position of the root of Fa(D) on the unit circle is
|
||||
* exp(j arccos(x0)).
|
||||
*/
|
||||
ta[0] = fa[nab-1];
|
||||
tb[0] = fb[nab-1];
|
||||
for (i = 1, j = nab - 2; i < nab; ++i, --j)
|
||||
{
|
||||
ta[i] = 2.0 * fa[j];
|
||||
tb[i] = 2.0 * fb[j];
|
||||
}
|
||||
|
||||
/*
|
||||
* To find the roots, we sample the polynomials Ta(x) and Tb(x) looking for
|
||||
* sign changes. An interval containing a root is successively bisected to
|
||||
* narrow the interval and then linear interpolation is used to estimate the
|
||||
* root. For a given root at x0, the line spectral pair is w0=acos(x0).
|
||||
*
|
||||
* Since the roots of the two polynomials interlace, the search for roots
|
||||
* alternates between the polynomials Ta(x) and Tb(x). The sampling interval
|
||||
* must be small enough to avoid having two cancelling sign changes in the
|
||||
* same interval. The sampling (grid) points were trained from a large amount
|
||||
* of LSP vectors derived with high accuracy and stored in a table.
|
||||
*/
|
||||
|
||||
nf = 0;
|
||||
t = ta;
|
||||
xroot = 2.0;
|
||||
ngrd = 0;
|
||||
xlow = grid[0];
|
||||
ylow = FNevChebP(xlow, t, nd2);
|
||||
|
||||
|
||||
/* Root search loop */
|
||||
while (ngrd<(Ngrd-1) && nf < LPCO)
|
||||
{
|
||||
|
||||
/* New trial point */
|
||||
ngrd++;
|
||||
xhigh = xlow;
|
||||
yhigh = ylow;
|
||||
xlow = grid[ngrd];
|
||||
ylow = FNevChebP(xlow, t, nd2);
|
||||
|
||||
if (ylow * yhigh <= 0.0)
|
||||
{
|
||||
|
||||
/* Bisections of the interval containing a sign change */
|
||||
dx = xhigh - xlow;
|
||||
for (i = 1; i <= NBIS; ++i)
|
||||
{
|
||||
dx = 0.5 * dx;
|
||||
xmid = xlow + dx;
|
||||
ymid = FNevChebP(xmid, t, nd2);
|
||||
if (ylow * ymid <= 0.0)
|
||||
{
|
||||
yhigh = ymid;
|
||||
xhigh = xmid;
|
||||
}
|
||||
else
|
||||
{
|
||||
ylow = ymid;
|
||||
xlow = xmid;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Linear interpolation in the subinterval with a sign change
|
||||
* (take care if yhigh=ylow=0)
|
||||
*/
|
||||
if (yhigh != ylow)
|
||||
xmid = xlow + dx * ylow / (ylow - yhigh);
|
||||
else
|
||||
xmid = xlow + dx;
|
||||
|
||||
/* New root position */
|
||||
lsp[nf] = acos(xmid)/PI;
|
||||
++nf;
|
||||
|
||||
/* Start the search for the roots of the next polynomial at the estimated
|
||||
* location of the root just found. We have to catch the case that the
|
||||
* two polynomials have roots at the same place to avoid getting stuck at
|
||||
* that root.
|
||||
*/
|
||||
if (xmid >= xroot)
|
||||
{
|
||||
xmid = xlow - dx;
|
||||
}
|
||||
xroot = xmid;
|
||||
if (t == ta)
|
||||
t = tb;
|
||||
else
|
||||
t = ta;
|
||||
xlow = xmid;
|
||||
ylow = FNevChebP(xlow, t, nd2);
|
||||
}
|
||||
}
|
||||
|
||||
if (nf != LPCO)
|
||||
{
|
||||
/* LPCO roots have not been found */
|
||||
printf("\nWARNING: a2lsp failed to find all lsp nf=%d LPCO=%d\n", nf, LPCO);
|
||||
for (i = 0; i < LPCO; i++)
|
||||
lsp[i] = old_lsp[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Update LSP of previous frame with the new LSP */
|
||||
for (i = 0; i < LPCO; i++)
|
||||
old_lsp[i] = lsp[i];
|
||||
}
|
||||
}
|
||||
|
||||
static Float FNevChebP(Float x, /* (i) value */
|
||||
Float *c, /* (i) coefficient array */
|
||||
int nd2)
|
||||
{
|
||||
Float t;
|
||||
Float b[NAB];
|
||||
int i;
|
||||
|
||||
t = x*2;
|
||||
b[0] = c[nd2];
|
||||
b[1] = c[nd2 - 1] + t*b[0];
|
||||
for (i = 2; i < nd2; i++)
|
||||
b[i] = c[nd2 - i] - b[i - 2] + t * b[i - 1];
|
||||
return (c[0] - b[nd2 - 2] + x * b[nd2 - 1]);
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* allpole.c -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: allpole.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bvcommon.h"
|
||||
|
||||
#define MAXDIM 160 /* maximum vector dimension */
|
||||
#define MAXORDER LPCO /* maximum filter order */
|
||||
|
||||
void apfilter(const Float *a, /* (i) a[m+1] prediction coefficients (m=10) */
|
||||
int m, /* (i) LPC order */
|
||||
Float *x, /* (i) input signal */
|
||||
Float *y, /* (o) output signal */
|
||||
int lg, /* (i) size of filtering */
|
||||
Float *mem, /* (i/o) input memory */
|
||||
int16_t update) /* (i) flag for memory update */
|
||||
{
|
||||
Float buf[MAXORDER + MAXDIM]; /* buffer for filter memory & signal */
|
||||
Float a0;
|
||||
Float *fp1;
|
||||
int i;
|
||||
int n;
|
||||
|
||||
/* copy filter memory to beginning part of temporary buffer */
|
||||
fp1 = &mem[m - 1];
|
||||
for (i = 0; i < m; i++)
|
||||
buf[i] = *fp1--; /* this buffer is used to avoid memory shifts */
|
||||
|
||||
/* loop through every element of the current vector */
|
||||
for (n = 0; n < lg; n++)
|
||||
{
|
||||
/* perform multiply-adds along the delay line of filter */
|
||||
fp1 = &buf[n];
|
||||
a0 = x[n];
|
||||
for (i = m; i > 0; i--)
|
||||
a0 -= *fp1++ * a[i];
|
||||
|
||||
/* update the output & temporary buffer for filter memory */
|
||||
y[n] = a0;
|
||||
*fp1 = a0;
|
||||
}
|
||||
|
||||
/* get the filter memory after filtering the current vector */
|
||||
if (update)
|
||||
{
|
||||
for (i = 0; i < m; i++)
|
||||
mem[i] = *fp1--;
|
||||
}
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* allzero.c -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: allzero.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bvcommon.h"
|
||||
|
||||
#define MAXDIM 160 /* maximum vector dimension */
|
||||
#define MAXORDER LPCO /* maximum filter order */
|
||||
|
||||
void azfilter(
|
||||
const Float *a, /* (i) prediction coefficients */
|
||||
int m, /* (i) LPC order */
|
||||
Float *x, /* (i) input signal vector */
|
||||
Float *y, /* (o) output signal vector */
|
||||
int lg, /* (i) size of filtering */
|
||||
Float *mem, /* (i/o) filter memory before filtering */
|
||||
int16_t update) /* (i) flag for memory update */
|
||||
{
|
||||
Float buf[MAXORDER + MAXDIM]; /* buffer for filter memory & signal */
|
||||
Float a0;
|
||||
Float *fp1;
|
||||
int i;
|
||||
int n;
|
||||
|
||||
/* copy filter memory to beginning part of temporary buffer */
|
||||
fp1 = &mem[m - 1];
|
||||
for (i = 0; i < m; i++)
|
||||
buf[i] = *fp1--; /* this buffer is used to avoid memory shifts */
|
||||
|
||||
/* loop through every element of the current vector */
|
||||
for (n = 0; n < lg; n++)
|
||||
{
|
||||
/* perform multiply-adds along the delay line of filter */
|
||||
fp1 = &buf[n];
|
||||
a0 = 0.0F;
|
||||
for (i = m; i > 0; i--)
|
||||
a0 += *fp1++ * a[i];
|
||||
|
||||
/* update the temporary buffer for filter memory */
|
||||
*fp1 = x[n];
|
||||
|
||||
/* do the last multiply-add separately and get the output */
|
||||
y[n] = a0 + x[n] * a[0];
|
||||
}
|
||||
|
||||
/* get the filter memory after filtering the current vector */
|
||||
if (update)
|
||||
{
|
||||
for (i = 0; i < m; i++)
|
||||
mem[i] = *fp1--;
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* autocor.c -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: autocor.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bvcommon.h"
|
||||
|
||||
#define WINSZ 320 /* maximum analysis window size */
|
||||
|
||||
void Autocor(Float *r, /* (o) : Autocorrelations */
|
||||
Float *x, /* (i) : Input signal */
|
||||
const Float *window, /* (i) : LPC Analysis window */
|
||||
int l_window, /* (i) : window length */
|
||||
int m) /* (i) : LPC order */
|
||||
{
|
||||
Float buf[WINSZ];
|
||||
Float a0;
|
||||
int i;
|
||||
int n;
|
||||
|
||||
/* Apply analysis window */
|
||||
for (n = 0; n < l_window; n++)
|
||||
buf[n] = x[n]*window[n];
|
||||
|
||||
/* Compute autocorrealtion coefficients up to lag order */
|
||||
for (i = 0; i <= m; i++)
|
||||
{
|
||||
a0 = 0.0F;
|
||||
for (n = i; n < l_window; n++)
|
||||
a0 += buf[n]*buf[n - i];
|
||||
r[i] = a0;
|
||||
}
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* bvcommon.h -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bvcommon.h,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
#include "typedef.h"
|
||||
|
||||
#ifndef BVCOMMON_H
|
||||
#define BVCOMMON_H
|
||||
|
||||
/* Function Prototypes */
|
||||
|
||||
void apfilter(const Float *a, /* (i) a[m+1] prediction coefficients (m=10) */
|
||||
int m, /* (i) LPC order */
|
||||
Float *x, /* (i) input signal */
|
||||
Float *y, /* (o) output signal */
|
||||
int lg, /* (i) size of filtering */
|
||||
Float *mem, /* (i/o) input memory */
|
||||
int16_t update); /* (i) flag for memory update */
|
||||
|
||||
void azfilter(const Float *a, /* (i) prediction coefficients */
|
||||
int m, /* (i) LPC order */
|
||||
Float *x, /* (i) input signal vector */
|
||||
Float *y, /* (o) output signal vector */
|
||||
int lg, /* (i) size of filtering */
|
||||
Float *mem, /* (i/o) filter memory before filtering */
|
||||
int16_t update); /* (i) flag for memory update */
|
||||
|
||||
void Autocor(Float *r, /* (o) : Autocorrelations */
|
||||
Float *x, /* (i) : Input signal */
|
||||
const Float *window, /* (i) : LPC Analysis window */
|
||||
int l_window, /* (i) : window length */
|
||||
int m); /* (i) : LPC order */
|
||||
|
||||
void Levinson(Float *r, /* (i): autocorrelation coefficients */
|
||||
Float *a, /* (o): LPC coefficients */
|
||||
Float *old_a, /* (i/o): LPC coefficients of previous frame */
|
||||
int m); /* (i): LPC order */
|
||||
|
||||
void a2lsp(Float pc[], /* (i) input the np+1 predictor coeff. */
|
||||
Float lsp[], /* (o) line spectral pairs */
|
||||
Float old_lsp[]); /* (i/o) old lsp[] (in case not found 10 roots) */
|
||||
|
||||
void lsp2a(Float *lsp, /* (i) LSP vector */
|
||||
Float *a); /* (o) LPC coefficients */
|
||||
|
||||
void stblz_lsp(Float *lsp, int order);
|
||||
|
||||
int stblchck(Float *x, int vdim);
|
||||
|
||||
/* LPC to LSP Conversion */
|
||||
extern Float grid[];
|
||||
|
||||
/* LPC bandwidth expansion */
|
||||
extern Float bwel[];
|
||||
|
||||
/* LPC WEIGHTING FILTER */
|
||||
extern Float STWAL[];
|
||||
|
||||
/* ----- Basic Codec Parameters ----- */
|
||||
#define LPCO 8 /* LPC Order */
|
||||
#define Ngrd 60 /* LPC to LSP Conversion */
|
||||
|
||||
#define LSPMIN 0.00150 /* minimum LSP frequency, 6/12 Hz for BV16/BV32 */
|
||||
#define LSPMAX 0.99775 /* maximum LSP frequency, 3991/7982 Hz for BV16/BV32 */
|
||||
#define DLSPMIN 0.01250 /* minimum LSP spacing, 50/100 Hz for BV16/BV32 */
|
||||
#define STBLDIM 3 /* dimension of stability enforcement */
|
||||
|
||||
#endif /* BVCOMMON_H */
|
|
@ -1,56 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* cmtables.c -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: cmtables.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "typedef.h"
|
||||
|
||||
Float bwel[] =
|
||||
{
|
||||
1.000000, 0.968526251091, 0.938025365420, 0.908506308303, 0.879914932377,
|
||||
0.852235186110, 0.825387345342, 0.799409908158, 0.774255089985
|
||||
};
|
||||
|
||||
Float STWAL[]=
|
||||
{
|
||||
1.000000, 0.750000, 0.562500, 0.421875, 0.316406, 0.237305, 0.177979, 0.133484, 0.100098
|
||||
};
|
||||
|
||||
Float grid[]=
|
||||
{
|
||||
0.9999390, 0.9935608, 0.9848633, 0.9725342, 0.9577942, 0.9409180, 0.9215393, 0.8995972,
|
||||
0.8753662, 0.8487854, 0.8198242, 0.7887573, 0.7558899, 0.7213440, 0.6853943, 0.6481323,
|
||||
0.6101379, 0.5709839, 0.5300903, 0.4882507, 0.4447632, 0.3993530, 0.3531189, 0.3058167,
|
||||
0.2585754, 0.2109680, 0.1630859, 0.1148682, 0.0657349, 0.0161438, -0.0335693, -0.0830994,
|
||||
-0.1319580, -0.1804199, -0.2279663, -0.2751465, -0.3224487, -0.3693237, -0.4155884, -0.4604187,
|
||||
-0.5034180, -0.5446472, -0.5848999, -0.6235962, -0.6612244, -0.6979980, -0.7336731, -0.7675781,
|
||||
-0.7998962, -0.8302002, -0.8584290, -0.8842468, -0.9077148, -0.9288635, -0.9472046, -0.9635010,
|
||||
-0.9772034, -0.9883118, -0.9955139, -0.9999390
|
||||
};
|
|
@ -1,92 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* levdur.c - Levinson Durbin
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: levdur.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bvcommon.h"
|
||||
|
||||
/* Levinson-Durbin recursion */
|
||||
void Levinson(Float *r, /* (i): autocorrelation coefficients */
|
||||
Float *a, /* (o): LPC coefficients */
|
||||
Float *old_a, /* (i/o): LPC coefficients of previous frame */
|
||||
int m) /* (i): LPC order */
|
||||
{
|
||||
Float alpha;
|
||||
Float a0, a1;
|
||||
Float rc, *aip, *aib, *alp;
|
||||
int mh, minc, ip;
|
||||
|
||||
*a = 1.;
|
||||
if (*r <= 0.0)
|
||||
goto illcond;
|
||||
|
||||
/* start durbin's recursion */
|
||||
rc = - *(r + 1) / *r;
|
||||
*(a + 1) = rc;
|
||||
alpha = *r + *(r+1) * rc;
|
||||
if (alpha <= 0.0)
|
||||
goto illcond;
|
||||
for (minc = 2; minc <= m; minc++)
|
||||
{
|
||||
a0 = 0.0;
|
||||
aip = a;
|
||||
aib = r + minc;
|
||||
for (ip = 0; ip <= minc - 1; ip++)
|
||||
a0 = a0 + *aib-- * *aip++;
|
||||
rc = -a0 / alpha;
|
||||
mh = minc / 2;
|
||||
aip = a + 1;
|
||||
aib = a + minc - 1;
|
||||
for (ip = 1; ip <= mh; ip++)
|
||||
{
|
||||
a1 = *aip + rc * *aib;
|
||||
*aib = *aib + rc * *aip;
|
||||
aib--;
|
||||
*aip++ = a1;
|
||||
}
|
||||
*(a+minc) = rc;
|
||||
alpha = alpha + rc * a0;
|
||||
if (alpha <= 0.0)
|
||||
goto illcond;
|
||||
}
|
||||
|
||||
aip = a;
|
||||
alp = old_a;
|
||||
for (ip = 0; ip <= m; ip++)
|
||||
*alp++ = *aip++;
|
||||
|
||||
return;
|
||||
illcond:
|
||||
aip = a;
|
||||
alp = old_a;
|
||||
for (ip = 0; ip <= m; ip++)
|
||||
*aip++ = *alp++;
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* lsp2a.c -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: lsp2a.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include "typedef.h"
|
||||
#include "bvcommon.h"
|
||||
|
||||
#define OR (LPCO+1) /* Maximum LPC order */
|
||||
#define PI 3.14159265358979
|
||||
|
||||
void lsp2a(
|
||||
Float *lsp, /* (i) LSP vector */
|
||||
Float *a) /* (o) LPC coefficients */
|
||||
{
|
||||
Float c1, c2, p[OR], q[OR];
|
||||
int orderd2, n, i, nor;
|
||||
|
||||
orderd2=LPCO/2;
|
||||
for (i = 1; i <= LPCO ; i++)
|
||||
p[i] = q[i]= 0.;
|
||||
/* Get Q & P polyn. less the (1 +- z-1) ( or (1 +- z-2) ) factor */
|
||||
p[0] = q[0] = 1.;
|
||||
for (n = 1; n <= orderd2; n++)
|
||||
{
|
||||
nor= 2 * n;
|
||||
c1 = 2. * cos((double)PI*lsp[nor-1]);
|
||||
c2 = 2. * cos((double)PI*lsp[nor-2]);
|
||||
for (i = nor; i >= 2; i--)
|
||||
{
|
||||
q[i] += q[i-2] - c1*q[i-1];
|
||||
p[i] += p[i-2] - c2*p[i-1];
|
||||
}
|
||||
q[1] -= c1;
|
||||
p[1] -= c2;
|
||||
}
|
||||
/* Get the the predictor coeff. */
|
||||
a[0] = 1.;
|
||||
a[1] = 0.5 * (p[1] + q[1]);
|
||||
for (i=1, n=2; i < LPCO ; i++, n++)
|
||||
a[n] = 0.5 * (p[i] + p[n] + q[n] - q[i]);
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* stblchck.c -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: stblchck.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "typedef.h"
|
||||
#include "bvcommon.h"
|
||||
|
||||
int stblchck(Float *x, int vdim)
|
||||
{
|
||||
int k;
|
||||
int stbl;
|
||||
|
||||
if (x[0] < 0.0)
|
||||
{
|
||||
stbl = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
stbl = 1;
|
||||
for (k = 1; k < vdim; k++)
|
||||
{
|
||||
if (x[k] - x[k-1] < 0.0)
|
||||
stbl = 0;
|
||||
}
|
||||
}
|
||||
return stbl;
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* stblzlsp.c - Find stability flag (LSPs)
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: stblzlsp.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "typedef.h"
|
||||
//#include "bv16cnst.h"
|
||||
#include "bvcommon.h"
|
||||
|
||||
void stblz_lsp(Float *lsp, int order)
|
||||
{
|
||||
|
||||
/* This function orders the lsp to prevent */
|
||||
/* unstable synthesis filters and imposes basic */
|
||||
/* lsp properties in order to avoid marginal */
|
||||
/* stability of the synthesis filter. */
|
||||
|
||||
int k, i;
|
||||
Float mintmp, maxtmp, a0;
|
||||
|
||||
|
||||
/* order lsps as minimum stability requirement */
|
||||
do
|
||||
{
|
||||
k = 0; /* use k as a flag for order reversal */
|
||||
for (i = 0; i < order - 1; i++)
|
||||
{
|
||||
if (lsp[i] > lsp[i+1]) /* if there is an order reversal */
|
||||
{
|
||||
a0 = lsp[i+1];
|
||||
lsp[i+1] = lsp[i]; /* swap the two LSP elements */
|
||||
lsp[i] = a0;
|
||||
k = 1; /* set the flag for order reversal */
|
||||
}
|
||||
}
|
||||
}
|
||||
while (k > 0); /* repeat order checking if there was order reversal */
|
||||
|
||||
|
||||
/* impose basic lsp properties */
|
||||
maxtmp=LSPMAX-(order-1)*DLSPMIN;
|
||||
|
||||
if (lsp[0] < LSPMIN)
|
||||
lsp[0] = LSPMIN;
|
||||
else if (lsp[0] > maxtmp)
|
||||
lsp[0] = maxtmp;
|
||||
|
||||
for (i=0; i<order-1; i++)
|
||||
{
|
||||
/* space lsp(i+1) */
|
||||
|
||||
/* calculate lower and upper bound for lsp(i+1) */
|
||||
mintmp=lsp[i]+DLSPMIN;
|
||||
maxtmp += DLSPMIN;
|
||||
|
||||
/* guarantee minimum spacing to lsp(i) */
|
||||
if (lsp[i+1] < mintmp)
|
||||
lsp[i+1] = mintmp;
|
||||
|
||||
/* make sure the remaining lsps fit within the remaining space */
|
||||
else if (lsp[i+1] > maxtmp)
|
||||
lsp[i+1] = maxtmp;
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* typedef.h -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: typedef.h,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
#if !defined(_TYPEDEF_H_)
|
||||
#define _TYPEDEF_H_
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
typedef double Float;
|
||||
|
||||
#endif
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* utility.c -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: utility.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "typedef.h"
|
||||
#include "utility.h"
|
||||
|
||||
void Fcopy(Float *y, Float *x, int size)
|
||||
{
|
||||
while ((size--) > 0)
|
||||
*y++ = *x++;
|
||||
}
|
||||
|
||||
void Fzero(Float *x, int size)
|
||||
{
|
||||
while ((size--) > 0)
|
||||
*x++ = 0.0;
|
||||
}
|
||||
|
||||
void F2s(int16_t *s, Float *f, int size)
|
||||
{
|
||||
Float t;
|
||||
int16_t v;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
t = *f++;
|
||||
|
||||
/* Rounding */
|
||||
if (t >= 0)
|
||||
t += 0.5;
|
||||
else
|
||||
t -= 0.5;
|
||||
|
||||
if (t > 32767.0)
|
||||
v = 32767;
|
||||
else if (t < -32768.0)
|
||||
v = -32768;
|
||||
else
|
||||
v = (int16_t) t;
|
||||
*s++ = v;
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||
*
|
||||
* utility.h -
|
||||
*
|
||||
* Adapted by Steve Underwood <steveu@coppice.org> from code which is
|
||||
* Copyright 2000-2009 Broadcom Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: utility.h,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
|
||||
*/
|
||||
|
||||
#include "typedef.h"
|
||||
|
||||
extern void Fcopy(Float *y, Float *x, int size);
|
||||
extern void Fzero(Float *x, int size);
|
||||
extern void F2s(int16_t *s, Float *f, int size);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue