From dfc1f5d2a91dbaa3b50aa85d4e2ccac81d5f5ed8 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Sat, 21 Nov 2009 19:45:06 +0000 Subject: [PATCH] update to http://www.soft-switch.org/downloads/snapshots/voipcodecs/broadvoice-20091122.tar.gz git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15602 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- libs/broadvoice/Makefile.am | 6 +- libs/broadvoice/broadvoice.pc.in | 11 + libs/broadvoice/broadvoice.spec | 5 +- libs/broadvoice/broadvoice.spec.in | 5 +- libs/broadvoice/configure.ac | 3 +- libs/broadvoice/debian/rules | 1 - libs/broadvoice/src/Makefile.am | 86 ++- libs/broadvoice/src/broadvoice.dsp | 184 +---- libs/broadvoice/src/broadvoice.vcproj | 566 +++++---------- libs/broadvoice/src/broadvoice/version.h | 2 +- libs/broadvoice/src/libbroadvoice.2005.sln | 29 + libs/broadvoice/src/libbroadvoice.2005.vcproj | 395 +++++++++++ libs/broadvoice/src/libbroadvoice.2008.sln | 29 + libs/broadvoice/src/libbroadvoice.2008.vcproj | 395 +++++++++++ libs/broadvoice/src/libbroadvoice.dsp | 299 ++++++++ libs/broadvoice/src/msvc/msvcproj.head | 24 +- libs/broadvoice/src/msvc/vc8proj.head | 668 +++++++++--------- libs/broadvoice/src/msvc/vc9proj.foot | 11 + libs/broadvoice/src/msvc/vc9proj.head | 334 +++++++++ libs/broadvoice/tests/Makefile.am | 18 +- libs/broadvoice/tests/broadvoice_tests.c | 361 ++++++++++ libs/broadvoice/tests/g192_bit_stream.c | 16 +- libs/broadvoice/tests/regression_tests.sh.in | 64 +- 23 files changed, 2499 insertions(+), 1013 deletions(-) create mode 100644 libs/broadvoice/broadvoice.pc.in create mode 100644 libs/broadvoice/src/libbroadvoice.2005.sln create mode 100644 libs/broadvoice/src/libbroadvoice.2005.vcproj create mode 100644 libs/broadvoice/src/libbroadvoice.2008.sln create mode 100644 libs/broadvoice/src/libbroadvoice.2008.vcproj create mode 100644 libs/broadvoice/src/libbroadvoice.dsp create mode 100644 libs/broadvoice/src/msvc/vc9proj.foot create mode 100644 libs/broadvoice/src/msvc/vc9proj.head create mode 100644 libs/broadvoice/tests/broadvoice_tests.c diff --git a/libs/broadvoice/Makefile.am b/libs/broadvoice/Makefile.am index 1a4d9b82ba..f99395399c 100644 --- a/libs/broadvoice/Makefile.am +++ b/libs/broadvoice/Makefile.am @@ -16,7 +16,7 @@ ## 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 $ +## $Id: Makefile.am,v 1.2 2009/11/21 17:19:22 steveu Exp $ AM_CFLAGS = $(COMP_VENDOR_CFLAGS) AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) @@ -26,6 +26,7 @@ noinst_SCRIPTS = broadvoice.spec MAINTAINERCLEANFILES = Makefile.in EXTRA_DIST = autogen.sh \ + broadvoice.pc \ broadvoice.spec \ wrapper.xsl \ doc/broadvoice-doxygen \ @@ -49,6 +50,9 @@ 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 diff --git a/libs/broadvoice/broadvoice.pc.in b/libs/broadvoice/broadvoice.pc.in new file mode 100644 index 0000000000..95b058d39e --- /dev/null +++ b/libs/broadvoice/broadvoice.pc.in @@ -0,0 +1,11 @@ +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} diff --git a/libs/broadvoice/broadvoice.spec b/libs/broadvoice/broadvoice.spec index 79115e7477..3de1e056ee 100644 --- a/libs/broadvoice/broadvoice.spec +++ b/libs/broadvoice/broadvoice.spec @@ -9,8 +9,6 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-root Source: http://www.soft-switch.org/downloads/codecs/broadvoice-0.0.1.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -Docdir: %{_prefix}/doc - BuildRequires: audiofile-devel BuildRequires: doxygen @@ -47,14 +45,13 @@ rm -rf %{buildroot} %{_libdir}/libbroadvoice.so.* -%{_datadir}/libbroadvoice - %files devel %defattr(-,root,root,-) %doc doc/api %{_includedir}/broadvoice.h %{_includedir}/broadvoice %{_libdir}/libbroadvoice.so +%{_libdir}/pkgconfig/broadvoice.pc %post -p /sbin/ldconfig diff --git a/libs/broadvoice/broadvoice.spec.in b/libs/broadvoice/broadvoice.spec.in index 384a5b743e..2ceb0abcc6 100644 --- a/libs/broadvoice/broadvoice.spec.in +++ b/libs/broadvoice/broadvoice.spec.in @@ -9,8 +9,6 @@ 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) -Docdir: %{_prefix}/doc - BuildRequires: audiofile-devel BuildRequires: doxygen @@ -47,14 +45,13 @@ rm -rf %{buildroot} %{_libdir}/libbroadvoice.so.* -%{_datadir}/libbroadvoice - %files devel %defattr(-,root,root,-) %doc doc/api %{_includedir}/broadvoice.h %{_includedir}/broadvoice %{_libdir}/libbroadvoice.so +%{_libdir}/pkgconfig/broadvoice.pc %post -p /sbin/ldconfig diff --git a/libs/broadvoice/configure.ac b/libs/broadvoice/configure.ac index 2e547b1447..7abfc32b22 100644 --- a/libs/broadvoice/configure.ac +++ b/libs/broadvoice/configure.ac @@ -16,7 +16,7 @@ # 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.1.1.1 2009/11/19 12:10:48 steveu Exp $ +# $Id: configure.ac,v 1.2 2009/11/21 17:19:22 steveu Exp $ # @start 1 @@ -384,6 +384,7 @@ AC_CONFIG_FILES([Makefile src/Makefile src/broadvoice.h tests/Makefile + broadvoice.pc broadvoice.spec]) AC_CONFIG_FILES([tests/regression_tests.sh], [chmod +x tests/regression_tests.sh]) diff --git a/libs/broadvoice/debian/rules b/libs/broadvoice/debian/rules index 1ccbf3ddd4..636e1b42ae 100644 --- a/libs/broadvoice/debian/rules +++ b/libs/broadvoice/debian/rules @@ -71,7 +71,6 @@ binary-indep: build-stamp install dh_testdir -i dh_testroot -i dh_installchangelogs -i ChangeLog - dh_installdocs -i DueDiligence dh_install -i dh_compress -i dh_fixperms -i diff --git a/libs/broadvoice/src/Makefile.am b/libs/broadvoice/src/Makefile.am index ba9b1f58af..f9cf614351 100644 --- a/libs/broadvoice/src/Makefile.am +++ b/libs/broadvoice/src/Makefile.am @@ -16,17 +16,18 @@ ## 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 $ +## $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 = broadvoice/version.h.in \ - broadvoice.dsp \ - broadvoice.sln \ - broadvoice.vcproj \ +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 \ @@ -35,10 +36,13 @@ EXTRA_DIST = broadvoice/version.h.in \ msvc/broadvoice.def \ msvc/msvcproj.head \ msvc/msvcproj.foot \ + msvc/vc8proj.foot \ msvc/vc8proj.head \ - msvc/vc8proj.foot - -INCLUDES = -I$(top_builddir) -Ifloating/common -Ifloating/bv16 -Ifloating/bv32 + msvc/vc9proj.foot \ + msvc/vc9proj.head \ + broadvoice/version.h.in + +INCLUDES = -I$(top_builddir) -I$(srcdir)/floating/common -I$(srcdir)/floating/bv16 -I$(srcdir)/floating/bv32 lib_LTLIBRARIES = libbroadvoice.la @@ -111,60 +115,80 @@ noinst_HEADERS = bitpack16.h \ noinst_PROGRAMS = -DSP = broadvoice.dsp -VCPROJ = broadvoice.vcproj +DSP = libbroadvoice.dsp +VCPROJ8 = libbroadvoice.2005.vcproj +VCPROJ9 = libbroadvoice.2008.vcproj -WIN32SOURCES = $(libbroadvoice_la_SOURCES) msvc/gettimeofday.c +WIN32SOURCES = $(libbroadvoice_la_SOURCES) .\\msvc\\gettimeofday.c WIN32HEADERS = $(nobase_include_HEADERS) broadvoice.h DSPOUT = | awk '{printf("%s\r\n", $$0)}' >> $(DSP) -VCPROJOUT = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ) +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 \ - myfile=`echo $$file | sed -e 's|/|\\\\|g'`; \ echo "# Begin Source File" $(DSPOUT); \ echo "" $(DSPOUT); \ - echo "SOURCE=.\\"$$myfile $(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 \ - myfile=`echo $$file | sed -e 's|/|\\\\|g'`; \ echo "# Begin Source File" $(DSPOUT); \ echo "" $(DSPOUT); \ - echo "SOURCE=.\\"$$myfile $(DSPOUT); \ + echo "SOURCE=.\\"$$file $(DSPOUT); \ echo "# End Source File" $(DSPOUT); \ done; \ echo "# End Group" $(DSPOUT); \ cat $(srcdir)/msvc/msvcproj.foot $(DSPOUT) ) -$(VCPROJ): msvc/vc8proj.head msvc/vc8proj.foot Makefile.am - echo "creating $(VCPROJ)" - @(cp $(srcdir)/msvc/vc8proj.head $(VCPROJ); \ +$(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 "" $(VCPROJOUT); \ + myfile=`echo $$file | sed -e 's|/|\\\\|g'`; \ + echo "" $(VCPROJOUT8); \ done; \ - echo "" $(VCPROJOUT); \ + echo "" $(VCPROJOUT8); \ for file in $(WIN32HEADERS); do \ - myfile=`echo $$file | sed -e 's|/|\\\\|g'`; \ - echo "" $(VCPROJOUT); \ + myfile=`echo $$file | sed -e 's|/|\\\\|g'`; \ + echo "" $(VCPROJOUT8); \ done; \ - cat $(srcdir)/msvc/vc8proj.foot $(VCPROJOUT) ) + 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 "" $(VCPROJOUT9); \ + done; \ + echo "" $(VCPROJOUT9); \ + for file in $(WIN32HEADERS); do \ + myfile=`echo $$file | sed -e 's|/|\\\\|g'`; \ + echo "" $(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 /" \ + -e "s/\@INSERT_MATH_HEADER\@/#include /" $(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'/' \ - broadvoice/version.h + <$(srcdir)/broadvoice/version.h.in >$@ -dist-hook: - NOWDATE=`date --utc +"%Y%m%d"` ; \ - NOWTIME=`date --utc +"%H%M%S"` ; \ - sed 's/$$BROADVOICE_RELEASE_DATE/'$$NOWDATE'/;s/$$BROADVOICE_RELEASE_TIME/'$$NOWTIME'/' \ - broadvoice/version.h +dist-hook: broadvoice/version.h diff --git a/libs/broadvoice/src/broadvoice.dsp b/libs/broadvoice/src/broadvoice.dsp index cff9477932..98ec47de3c 100644 --- a/libs/broadvoice/src/broadvoice.dsp +++ b/libs/broadvoice/src/broadvoice.dsp @@ -93,197 +93,21 @@ LINK32=link.exe # Begin Group "Source Files" # Begin Source File -SOURCE=.\bitstream.c -# End Source File -# Begin Source File - -SOURCE=.\floating\common\a2lsp.c -# End Source File -# Begin Source File - -SOURCE=.\floating\common\allpole.c -# End Source File -# Begin Source File - -SOURCE=.\floating\common\allzero.c -# End Source File -# Begin Source File - -SOURCE=.\floating\common\autocor.c -# End Source File -# Begin Source File - -SOURCE=.\floating\common\cmtables.c -# End Source File -# Begin Source File - -SOURCE=.\floating\common\levdur.c -# End Source File -# Begin Source File - -SOURCE=.\floating\common\lsp2a.c -# End Source File -# Begin Source File - -SOURCE=.\floating\common\stblchck.c -# End Source File -# Begin Source File - -SOURCE=.\floating\common\stblzlsp.c -# End Source File -# Begin Source File - -SOURCE=.\floating\common\utility.c -# End Source File -# Begin Source File - -SOURCE=.\bitpack16.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv16\bv16decoder.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv16\bv16encoder.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv16\bv16coarse_pitch.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv16\bv16excdec.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv16\bv16excquan.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv16\bv16fine_pitch.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv16\bv16gaindec.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv16\bv16gainquan.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv16\bv16levelest.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv16\bv16lspdec.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv16\bv16lspquan.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv16\bv16plc.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv16\bv16ptdec.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv16\bv16postfilter.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv16\bv16ptquan.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv16\bv16tables.c -# End Source File -# Begin Source File - -SOURCE=.\bitpack32.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv32\bv32decoder.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv32\bv32encoder.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv32\bv32coarse_pitch.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv32\bv32excdec.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv32\bv32excquan.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv32\bv32fine_pitch.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv32\bv32gaindec.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv32\bv32gainquan.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv32\bv32levelest.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv32\bv32lspdec.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv32\bv32lspquan.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv32\bv32plc.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv32\bv32ptdec.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv32\bv32ptquan.c -# End Source File -# Begin Source File - -SOURCE=.\floating\bv32\bv32tables.c -# End Source File -# Begin Source File - -SOURCE=.\msvc\gettimeofday.c +SOURCE=.\msvc/gettimeofday.c # End Source File # End Group # Begin Group "Header Files" # Begin Source File -SOURCE=.\broadvoice\broadvoice.h +SOURCE=.\broadvoice/broadvoice.h # End Source File # Begin Source File -SOURCE=.\broadvoice\version.h +SOURCE=.\broadvoice/version.h # End Source File # Begin Source File -SOURCE=.\broadvoice\private\broadvoice.h +SOURCE=.\broadvoice/private/broadvoice.h # End Source File # Begin Source File diff --git a/libs/broadvoice/src/broadvoice.vcproj b/libs/broadvoice/src/broadvoice.vcproj index 894878031a..929bebf07b 100644 --- a/libs/broadvoice/src/broadvoice.vcproj +++ b/libs/broadvoice/src/broadvoice.vcproj @@ -1,386 +1,188 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/broadvoice/src/libbroadvoice.2008.sln b/libs/broadvoice/src/libbroadvoice.2008.sln new file mode 100644 index 0000000000..a92dbec4c5 --- /dev/null +++ b/libs/broadvoice/src/libbroadvoice.2008.sln @@ -0,0 +1,29 @@ + +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 diff --git a/libs/broadvoice/src/libbroadvoice.2008.vcproj b/libs/broadvoice/src/libbroadvoice.2008.vcproj new file mode 100644 index 0000000000..952ed21e26 --- /dev/null +++ b/libs/broadvoice/src/libbroadvoice.2008.vcproj @@ -0,0 +1,395 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/broadvoice/src/libbroadvoice.dsp b/libs/broadvoice/src/libbroadvoice.dsp new file mode 100644 index 0000000000..64da5e4c06 --- /dev/null +++ b/libs/broadvoice/src/libbroadvoice.dsp @@ -0,0 +1,299 @@ +# Microsoft Developer Studio Project File - Name="gbroadvoice" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=gbroadvoice - 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 "gbroadvoice.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 "gbroadvoice.mak" CFG="gbroadvoice - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "gbroadvoice - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "gbroadvoice - 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)" == "gbroadvoice - 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/libgbroadvoice.dll" + +!ELSEIF "$(CFG)" == "gbroadvoice - 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/libgbroadvoice.dll" /pdbtype:sept +# SUBTRACT LINK32 /nodefaultlib + +!ENDIF + +# Begin Target + +# Name "gbroadvoice - Win32 Release" +# Name "gbroadvoice - Win32 Debug" +# Begin Group "Source Files" +# Begin Source File + +SOURCE=.\bitstream.c +# End Source File +# Begin Source File + +SOURCE=.\floating/common/a2lsp.c +# End Source File +# Begin Source File + +SOURCE=.\floating/common/allpole.c +# End Source File +# Begin Source File + +SOURCE=.\floating/common/allzero.c +# End Source File +# Begin Source File + +SOURCE=.\floating/common/autocor.c +# End Source File +# Begin Source File + +SOURCE=.\floating/common/cmtables.c +# End Source File +# Begin Source File + +SOURCE=.\floating/common/levdur.c +# End Source File +# Begin Source File + +SOURCE=.\floating/common/lsp2a.c +# End Source File +# Begin Source File + +SOURCE=.\floating/common/stblchck.c +# End Source File +# Begin Source File + +SOURCE=.\floating/common/stblzlsp.c +# End Source File +# Begin Source File + +SOURCE=.\floating/common/utility.c +# End Source File +# Begin Source File + +SOURCE=.\bitpack16.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv16/bv16decoder.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv16/bv16encoder.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv16/bv16coarse_pitch.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv16/bv16excdec.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv16/bv16excquan.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv16/bv16fine_pitch.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv16/bv16gaindec.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv16/bv16gainquan.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv16/bv16levelest.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv16/bv16lspdec.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv16/bv16lspquan.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv16/bv16plc.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv16/bv16ptdec.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv16/bv16postfilter.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv16/bv16ptquan.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv16/bv16tables.c +# End Source File +# Begin Source File + +SOURCE=.\bitpack32.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv32/bv32decoder.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv32/bv32encoder.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv32/bv32coarse_pitch.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv32/bv32excdec.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv32/bv32excquan.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv32/bv32fine_pitch.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv32/bv32gaindec.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv32/bv32gainquan.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv32/bv32levelest.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv32/bv32lspdec.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv32/bv32lspquan.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv32/bv32plc.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv32/bv32ptdec.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv32/bv32ptquan.c +# End Source File +# Begin Source File + +SOURCE=.\floating/bv32/bv32tables.c +# End Source File +# 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 diff --git a/libs/broadvoice/src/msvc/msvcproj.head b/libs/broadvoice/src/msvc/msvcproj.head index 37ea9197e4..b04688a828 100644 --- a/libs/broadvoice/src/msvc/msvcproj.head +++ b/libs/broadvoice/src/msvc/msvcproj.head @@ -1,24 +1,24 @@ -# Microsoft Developer Studio Project File - Name="g722_1" - Package Owner=<4> +# Microsoft Developer Studio Project File - Name="gbroadvoice" - 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 +CFG=gbroadvoice - 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 NMAKE /f "gbroadvoice.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 NMAKE /f "gbroadvoice.mak" CFG="gbroadvoice - 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 "gbroadvoice - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "gbroadvoice - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project @@ -29,7 +29,7 @@ CPP=cl.exe MTL=midl.exe RSC=rc.exe -!IF "$(CFG)" == "g722_1 - Win32 Release" +!IF "$(CFG)" == "gbroadvoice - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 @@ -54,9 +54,9 @@ BSC32=bscmake.exe # 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" +# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /map /debug /machine:I386 /out:"Release/libgbroadvoice.dll" -!ELSEIF "$(CFG)" == "g722_1 - Win32 Debug" +!ELSEIF "$(CFG)" == "gbroadvoice - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 @@ -81,12 +81,12 @@ BSC32=bscmake.exe # 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 +# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"Debug/libgbroadvoice.dll" /pdbtype:sept # SUBTRACT LINK32 /nodefaultlib !ENDIF # Begin Target -# Name "g722_1 - Win32 Release" -# Name "g722_1 - Win32 Debug" +# Name "gbroadvoice - Win32 Release" +# Name "gbroadvoice - Win32 Debug" diff --git a/libs/broadvoice/src/msvc/vc8proj.head b/libs/broadvoice/src/msvc/vc8proj.head index 068554071e..2f942b531e 100644 --- a/libs/broadvoice/src/msvc/vc8proj.head +++ b/libs/broadvoice/src/msvc/vc8proj.head @@ -1,334 +1,334 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/broadvoice/src/msvc/vc9proj.foot b/libs/broadvoice/src/msvc/vc9proj.foot new file mode 100644 index 0000000000..5586886173 --- /dev/null +++ b/libs/broadvoice/src/msvc/vc9proj.foot @@ -0,0 +1,11 @@ + + + + + + + diff --git a/libs/broadvoice/src/msvc/vc9proj.head b/libs/broadvoice/src/msvc/vc9proj.head new file mode 100644 index 0000000000..068554071e --- /dev/null +++ b/libs/broadvoice/src/msvc/vc9proj.head @@ -0,0 +1,334 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/broadvoice/tests/Makefile.am b/libs/broadvoice/tests/Makefile.am index 6f110ef409..2ad9c50709 100644 --- a/libs/broadvoice/tests/Makefile.am +++ b/libs/broadvoice/tests/Makefile.am @@ -16,18 +16,14 @@ ## 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 $ +## $Id: Makefile.am,v 1.2 2009/11/20 13:12:23 steveu Exp $ AM_CFLAGS = $(COMP_VENDOR_CFLAGS) AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) LIBS += $(TESTLIBS) -EXTRA_DIST = regression_tests.sh \ - bv16_fixed_tests.sh \ - bv32_fixed_tests.sh \ - bv16_floating_tests.sh \ - bv32_floating_tests.sh +EXTRA_DIST = regression_tests.sh.in MAINTAINERCLEANFILES = Makefile.in @@ -35,14 +31,10 @@ INCLUDES = -I$(top_builddir)/src -DDATADIR="\"$(pkgdatadir)\"" LIBDIR = -L$(top_builddir)/src -noinst_PROGRAMS = bv16_tests \ - bv32_tests +noinst_PROGRAMS = broadvoice_tests noinst_HEADERS = g192_bit_stream.h \ timing.h -bv16_tests_SOURCES = bv16_tests.c g192_bit_stream.c -bv16_tests_LDADD = $(LIBDIR) -lbroadvoice - -bv32_tests_SOURCES = bv32_tests.c g192_bit_stream.c -bv32_tests_LDADD = $(LIBDIR) -lbroadvoice +broadvoice_tests_SOURCES = broadvoice_tests.c g192_bit_stream.c +broadvoice_tests_LDADD = $(LIBDIR) -lbroadvoice diff --git a/libs/broadvoice/tests/broadvoice_tests.c b/libs/broadvoice/tests/broadvoice_tests.c new file mode 100644 index 0000000000..6435aabadf --- /dev/null +++ b/libs/broadvoice/tests/broadvoice_tests.c @@ -0,0 +1,361 @@ +/* + * broadvoice - a library for the BroadVoice 16 and 32 codecs + * + * broadvoice_tests.c + * + * Copyright 2008-2009 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: broadvoice_tests.c,v 1.2 2009/11/20 13:12:23 steveu Exp $ + */ + +/*! \file */ + +/*! \page broadvoice_tests_page BroadVoice 16 and 32 codec tests +\section broadvoice_tests_page_sec_1 What does it do? + +\section broadvoice_tests_page_sec_2 How is it used? +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include + +#define BROADVOICE_EXPOSE_INTERNAL_STRUCTURES +#include + +#include "timing.h" +#include "g192_bit_stream.h" + +#define MAX_FRAME_SIZE 80 +#define MAX_BITS_PER_FRAME 160 + +typedef struct +{ + int encode; + int encoded_format; + int bit_rate; + int sample_rate; + int number_of_bits_per_frame; + int frame_size; + char *source_file; + char *dest_file; + FILE *fp; + FILE *fp_bitstream; +} coder_control_t; + +static int encode_test(coder_control_t *control, int frames) +{ + bv16_encode_state_t encode_state_16; + bv16_encode_state_t *s16; + bv32_encode_state_t encode_state_32; + bv32_encode_state_t *s32; + int16_t amp[frames*MAX_FRAME_SIZE]; + uint8_t bv_code[frames*MAX_BITS_PER_FRAME/8]; + int samples; + int padded_samples; + int frame_cnt; + int bytes; + int actual_frames; + int i; + int64_t start; + int64_t end; + int64_t total; + + if ((control->fp = fopen(control->source_file, "rb")) == NULL) + { + printf("Error opening %s.\n", control->source_file); + exit(1); + } + if ((control->fp_bitstream = fopen(control->dest_file, "wb")) == NULL) + { + printf("Error opening %s.\n", control->dest_file); + exit(1); + } + + s16 = NULL; + s32 = NULL; + if (control->bit_rate == 16000) + { + if ((s16 = bv16_encode_init(&encode_state_16)) == NULL) + { + printf("Failed to initialise the encoder.\n"); + exit(2); + } + } + else + { + if ((s32 = bv32_encode_init(&encode_state_32)) == NULL) + { + printf("Failed to initialise the encoder.\n"); + exit(2); + } + } + frame_cnt = 0; + total = 0; + for (;;) + { + samples = fread(amp, sizeof(int16_t), frames*control->frame_size, control->fp); + if (samples <= 0) + break; + if (samples%control->frame_size != 0) + { + padded_samples = samples - samples%control->frame_size + control->frame_size; + /* Pad this fractional frame out to a full one with silence */ + for (i = samples; i < padded_samples; i++) + amp[i] = 0; + samples = padded_samples; + } + actual_frames = samples/control->frame_size; + start = rdtscll(); + if (control->bit_rate == 16000) + bytes = bv16_encode(s16, bv_code, amp, samples); + else + bytes = bv32_encode(s32, bv_code, amp, samples); + end = rdtscll(); + frame_cnt += actual_frames; + /* Write output bitstream to the output file */ + for (i = 0; i < actual_frames; i++) + itu_codec_bitstream_write(&bv_code[i*bytes/actual_frames], 8*bytes/actual_frames, control->encoded_format, control->fp_bitstream); + total += (end - start); + } + fclose(control->fp); + fclose(control->fp_bitstream); + printf("%d frames encoded\n", frame_cnt); + if (frame_cnt == 0) + frame_cnt = 1; + printf("%" PRId64 " cycles. %" PRId64 " per frame\n", total, total/frame_cnt); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int decode_test(coder_control_t *control, int frames) +{ + bv16_decode_state_t decode_state_16; + bv16_decode_state_t *s16; + bv32_decode_state_t decode_state_32; + bv32_decode_state_t *s32; + int16_t amp[frames*MAX_FRAME_SIZE]; + uint8_t bv_code[frames*MAX_BITS_PER_FRAME/8]; + int bytes; + int samples; + int frame_cnt; + int number_of_bytes_per_frame; + int actual_frames; + int i; + int j; + int k; + int n; + int16_t frame_error_flag; + int64_t start; + int64_t end; + int64_t total; + + if ((control->fp_bitstream = fopen(control->source_file, "rb")) == NULL) + { + printf("Error opening %s.\n", control->source_file); + exit(1); + } + if ((control->fp = fopen(control->dest_file, "wb")) == NULL) + { + printf("Error opening %s.\n", control->dest_file); + exit(1); + } + + number_of_bytes_per_frame = control->number_of_bits_per_frame/8; + + s16 = NULL; + s32 = NULL; + if (control->bit_rate == 16000) + { + if ((s16 = bv16_decode_init(&decode_state_16)) == NULL) + { + printf("Failed to initialise the decoder.\n"); + exit(2); + } + } + else + { + if ((s32 = bv32_decode_init(&decode_state_32)) == NULL) + { + printf("Failed to initialise the decoder.\n"); + exit(2); + } + } + + frame_cnt = 0; + total = 0; + frame_error_flag = 0; + n = 0; + for (;;) + { + for (actual_frames = 0, bytes = 0, i = 0; i < frames; i++) + { + n = itu_codec_bitstream_read(&bv_code[i*number_of_bytes_per_frame], + &frame_error_flag, + number_of_bytes_per_frame*8, + control->encoded_format, + control->fp_bitstream)/8; + bytes += n; + if (n == number_of_bytes_per_frame) + actual_frames++; + if (frame_error_flag || n != number_of_bytes_per_frame) + break; + } + if (frame_error_flag || bytes >= number_of_bytes_per_frame) + { + if (frame_error_flag) + { + samples = 0; + if (actual_frames > 0) + { + start = rdtscll(); + if (control->bit_rate == 16000) + samples = bv16_decode(s16, amp, bv_code, bytes - number_of_bytes_per_frame); + else + samples = bv32_decode(s32, amp, bv_code, bytes - number_of_bytes_per_frame); + end = rdtscll(); + total += (end - start); + } + j = bytes - number_of_bytes_per_frame; + if (j < 0) + j = 0; + k = (actual_frames - 1)*control->frame_size; + if (k < 0) + k = 0; +#if 0 + if (control->bit_rate == 16000) + samples += bv16_fillin(s16, &[k], &bv_code[j], number_of_bytes_per_frame); + else + samples += bv32_fillin(s32, &[k], &bv_code[j], number_of_bytes_per_frame); +#else + if (control->bit_rate == 16000) + samples += bv16_fillin(s16, &[k], number_of_bytes_per_frame); + else + samples += bv32_fillin(s32, &[k], number_of_bytes_per_frame); +#endif + } + else + { + start = rdtscll(); + if (control->bit_rate == 16000) + samples = bv16_decode(s16, amp, bv_code, bytes); + else + samples = bv32_decode(s32, amp, bv_code, bytes); + end = rdtscll(); + total += (end - start); + } + frame_cnt += actual_frames; + /* For ITU testing, chop off the 2 LSBs. */ + //for (i = 0; i < samples; i++) + // amp[i] &= 0xFFFC; + /* Write frame of output samples */ + fwrite(amp, sizeof(int16_t), samples, control->fp); + } + if (!frame_error_flag && n != number_of_bytes_per_frame) + break; + } + fclose(control->fp); + fclose(control->fp_bitstream); + printf("%d frames decoded\n", frame_cnt); + if (frame_cnt == 0) + frame_cnt = 1; + printf("%" PRId64 " cycles. %" PRId64 " per frame\n", total, total/frame_cnt); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void parse_command_line(char *argv[], coder_control_t *control) +{ + control->encode = (strcasecmp(*++argv, "e") == 0); + + if (strcasecmp(*++argv, "p") == 0) + { + control->encoded_format = ITU_CODEC_BITSTREAM_PACKED; + printf("Encoding format = packed bitstream\n"); + } + else if (strcasecmp(*argv, "i") == 0) + { + control->encoded_format = ITU_CODEC_BITSTREAM_G192; + printf("Encoding format = ITU G.192 format bitstream\n"); + } + else + { + printf("Error. Encoded format must be P for packed, or I for ITU format\n"); + exit(1); + } + control->bit_rate = (int32_t) atoi(*++argv); + control->number_of_bits_per_frame = (int16_t) (control->bit_rate/200); + + + control->sample_rate = (control->bit_rate == 16000) ? 8000 : 16000; + if (control->sample_rate == 8000) + { + control->frame_size = MAX_FRAME_SIZE >> 1; + + printf("Sample rate = 8000 (BroadVoice16, 3.4kHz bandwidth)\n"); + } + else if (control->sample_rate == 16000) + { + control->frame_size = MAX_FRAME_SIZE; + + printf("Sample rate = 16000 (BroadVoice32, 7.1kHz bandwidth)\n"); + } + else + { + printf("Error. Sample rate must be 8000 or 16000\n"); + exit(1); + } + control->source_file = *++argv; + control->dest_file = *++argv; + + printf("Bit rate = %d\n", control->bit_rate); + printf("Framesize = %d samples\n", control->frame_size); + printf("Number of bits per frame = %d bits\n", control->number_of_bits_per_frame); + printf("\n"); + printf("\n"); +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + coder_control_t control; + + /* Check usage */ + if (argc < 6) + { + printf("Usage: %s \n\n", argv[0]); + printf("Sample rate: 3.5kHz = 8000\n"); + printf(" 7.1kHz = 16000\n"); + printf("\n"); + exit(1); + } + + parse_command_line(argv, &control); + if (control.encode) + encode_test(&control, 4); + else + decode_test(&control, 4); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/broadvoice/tests/g192_bit_stream.c b/libs/broadvoice/tests/g192_bit_stream.c index 7b2d9748a4..a4b72bd61d 100644 --- a/libs/broadvoice/tests/g192_bit_stream.c +++ b/libs/broadvoice/tests/g192_bit_stream.c @@ -20,7 +20,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: g192_bit_stream.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $ + * $Id: g192_bit_stream.c,v 1.2 2009/11/20 13:12:24 steveu Exp $ */ /*! \file */ @@ -92,7 +92,7 @@ void itu_codec_bitstream_write(const uint8_t out_data[], /*- End of function --------------------------------------------------------*/ int itu_codec_bitstream_read(uint8_t in_data[], - int16_t *p_frame_error_flag, + int16_t *frame_error_flag, int number_of_bits, int mode, FILE *fp_bitstream) @@ -107,6 +107,7 @@ int itu_codec_bitstream_read(uint8_t in_data[], int16_t bit; int16_t in_array[2 + number_of_bits]; + *frame_error_flag = 0; if (mode == ITU_CODEC_BITSTREAM_PACKED) return fread(in_data, 1, number_of_bits/8, fp_bitstream)*8; @@ -115,23 +116,22 @@ int itu_codec_bitstream_read(uint8_t in_data[], return -1; if (in_array[0] < G192_FRAME_ERASURE || in_array[0] > G192_FRAME_SYNC_15) { - *p_frame_error_flag = 1; + *frame_error_flag = 1; return 0; } erased_frame = (in_array[0] == G192_FRAME_ERASURE); len = in_array[1]; if (len > number_of_bits) { - *p_frame_error_flag = 1; + *frame_error_flag = 1; return 0; } nsamp = fread(in_array, sizeof(int16_t), len, fp_bitstream); if (nsamp != len) { - *p_frame_error_flag = 1; + *frame_error_flag = 1; return nsamp; } - *p_frame_error_flag = 0; for (i = 0, j = 0; i < nsamp/8; i++) { @@ -152,14 +152,14 @@ int itu_codec_bitstream_read(uint8_t in_data[], else { /* Bad bit */ - *p_frame_error_flag = 1; + *frame_error_flag = 1; } bit_pos--; } in_data[i] = packed_word; } if (erased_frame) - *p_frame_error_flag = 1; + *frame_error_flag = 1; return nsamp; } /*- End of function --------------------------------------------------------*/ diff --git a/libs/broadvoice/tests/regression_tests.sh.in b/libs/broadvoice/tests/regression_tests.sh.in index f552a9d6b9..f7adfdf706 100644 --- a/libs/broadvoice/tests/regression_tests.sh.in +++ b/libs/broadvoice/tests/regression_tests.sh.in @@ -17,87 +17,69 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # -# $Id: regression_tests.sh.in,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $ +# $Id: regression_tests.sh.in,v 1.2 2009/11/20 13:12:24 steveu Exp $ # STDOUT_DEST=xyzzy STDERR_DEST=xyzzy2 -VECTOR_CLASS=@G722_1_VECTORS_FOR_TESTS@ +VECTOR_CLASS=@BROADVOICE_VECTORS_FOR_TESTS@ TMP_FILE=tmp -echo Performing basic G.722_1 regression tests +echo Performing basic BroadVoice 16 and 32 regression tests echo -./broadvoice_tests E I 32000 16000 ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_enc_in.pcm $TMP_FILE -diff $TMP_FILE ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_enc_out_32000.itu +./broadvoice_tests E I 32000 ../test-data/broadcom/$VECTOR_CLASS/bv32/tv.raw $TMP_FILE +diff $TMP_FILE ../test-data/broadcom/$VECTOR_CLASS/bv32/tv.bv32.ref RETVAL=$? if [ $RETVAL != 0 ] then - echo broadvoice_tests E failed! + echo broadvoice_tests encode failed! exit $RETVAL fi -./broadvoice_tests E I 24000 16000 ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_enc_in.pcm $TMP_FILE -diff $TMP_FILE ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_enc_out_24000.itu +./broadvoice_tests E I 16000 ../test-data/broadcom/$VECTOR_CLASS/bv16/tv.raw $TMP_FILE +diff $TMP_FILE ../test-data/broadcom/$VECTOR_CLASS/bv16/tv.bv16.ref RETVAL=$? if [ $RETVAL != 0 ] then - echo broadvoice_tests E failed! + echo broadvoice_tests encode failed! exit $RETVAL fi -echo broadvoice_tests E completed OK +echo broadvoice_tests encode completed OK -./broadvoice_tests D I 24000 16000 ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_enc_out_24000.itu $TMP_FILE -diff $TMP_FILE ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_dec_out_24000.pcm +./broadvoice_tests D I 32000 ../test-data/broadcom/$VECTOR_CLASS/bv32/tv.bv32.ref $TMP_FILE +diff $TMP_FILE ../test-data/broadcom/$VECTOR_CLASS/bv32/tv.bv32.ref.raw RETVAL=$? if [ $RETVAL != 0 ] then - echo broadvoice_tests D failed! + echo broadvoice_tests decode failed! exit $RETVAL fi -./broadvoice_tests D I 32000 16000 ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_enc_out_32000.itu $TMP_FILE -diff $TMP_FILE ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_dec_out_32000.pcm +./broadvoice_tests D I 16000 ../test-data/broadcom/$VECTOR_CLASS/bv16/tv.bv16.ref $TMP_FILE +diff $TMP_FILE ../test-data/broadcom/$VECTOR_CLASS/bv16/tv.bv16.ref.raw RETVAL=$? if [ $RETVAL != 0 ] then - echo broadvoice_tests D failed! + echo broadvoice_tests decode failed! exit $RETVAL fi -./broadvoice_tests D I 24000 16000 ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_dec_in_24000_fe.itu $TMP_FILE -diff $TMP_FILE ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_dec_out_24000_fe.pcm +./broadvoice_tests D I 32000 ../test-data/broadcom/$VECTOR_CLASS/bv32/tv.bfe10.bv32 $TMP_FILE +diff $TMP_FILE ../test-data/broadcom/$VECTOR_CLASS/bv32/tv.bv32.bfe10.ref.raw RETVAL=$? if [ $RETVAL != 0 ] then - echo broadvoice_tests D failed! + echo broadvoice_tests decode failed! exit $RETVAL fi -./broadvoice_tests D I 32000 16000 ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_dec_in_32000_fe.itu $TMP_FILE -diff $TMP_FILE ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_dec_out_32000_fe.pcm +./broadvoice_tests D I 16000 ../test-data/broadcom/$VECTOR_CLASS/bv16/tv.bfe10.bv16 $TMP_FILE +diff $TMP_FILE ../test-data/broadcom/$VECTOR_CLASS/bv16/tv.bv16.bfe10.ref.raw RETVAL=$? if [ $RETVAL != 0 ] then - echo broadvoice_tests D failed! + echo broadvoice_tests decode failed! exit $RETVAL fi -echo broadvoice_tests D completed OK - -./broadvoice_tests E I 32000 16000 ../test-data/local/short_wb_voice.wav $TMP_FILE -RETVAL=$? -if [ $RETVAL != 0 ] -then - echo broadvoice_tests E failed! - exit $RETVAL -fi -echo broadvoice_tests E completed OK - -./broadvoice_tests D I 32000 16000 $TMP_FILE test.au -RETVAL=$? -if [ $RETVAL != 0 ] -then - echo broadvoice_tests D failed! - exit $RETVAL -fi -echo broadvoice_tests D completed OK +echo broadvoice_tests decode completed OK echo echo All regression tests successfully completed