[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 03/10: gr-vocoder: gsm subcomponent using e
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 03/10: gr-vocoder: gsm subcomponent using external gsm library |
Date: |
Wed, 3 Aug 2016 23:35:10 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch next
in repository gnuradio.
commit d2afb9f9698a34bdd6f6dc43298a4521fcd30da1
Author: A. Maitland Bottoms <address@hidden>
Date: Sat Jun 25 18:08:44 2016 -0400
gr-vocoder: gsm subcomponent using external gsm library
---
cmake/Modules/FindGSM.cmake | 52 ++++++++++++++
gr-vocoder/CMakeLists.txt | 10 ++-
gr-vocoder/examples/CMakeLists.txt | 11 ++-
gr-vocoder/grc/CMakeLists.txt | 13 +++-
gr-vocoder/include/gnuradio/vocoder/CMakeLists.txt | 13 ++--
gr-vocoder/lib/CMakeLists.txt | 82 +++-------------------
gr-vocoder/lib/gsm_fr_decode_ps_impl.cc | 3 +-
gr-vocoder/lib/gsm_fr_encode_sp_impl.cc | 3 +-
gr-vocoder/python/vocoder/CMakeLists.txt | 8 ++-
gr-vocoder/swig/CMakeLists.txt | 6 +-
gr-vocoder/swig/vocoder_swig.i | 21 ++++--
11 files changed, 127 insertions(+), 95 deletions(-)
diff --git a/cmake/Modules/FindGSM.cmake b/cmake/Modules/FindGSM.cmake
new file mode 100644
index 0000000..7db2ada
--- /dev/null
+++ b/cmake/Modules/FindGSM.cmake
@@ -0,0 +1,52 @@
+# Copyright 2016 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+###########################
+# Check for system libgsm #
+###########################
+
+INCLUDE(FindPkgConfig)
+INCLUDE(FindPackageHandleStandardArgs)
+
+pkg_check_modules(LIBGSM_PKG QUIET gsm)
+
+find_path(LIBGSM_INCLUDE_DIR NAMES gsm.h
+ PATHS
+ ${LIBGSM_PKG_INCLUDE_DIRS}
+ /usr/local/include/gsm
+ /usr/local/include
+ /usr/include/gsm
+ /usr/include
+ )
+
+find_library(LIBGSM_LIBRARIES NAMES gsm
+ PATHS
+ ${LIBGSM_PKG_LIBRARY_DIRS}
+ /usr/local/lib
+ /usr/lib
+ )
+
+if(LIBGSM_INCLUDE_DIR AND LIBGSM_LIBRARIES)
+ set(LIBGSM_FOUND TRUE)
+ set(LIBGSM_INCLUDE_DIRS ${LIBGSM_INCLUDE_DIR})
+ set(LIBGSM_LIBRARIES ${LIBGSM_LIBRARIES} ${LIBGSM_LIBRARY})
+endif(LIBGSM_INCLUDE_DIR AND LIBGSM_LIBRARIES)
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBGSM DEFAULT_MSG LIBGSM_LIBRARIES
LIBGSM_INCLUDE_DIRS)
+mark_as_advanced(LIBGSM_INCLUDE_DIR LIBGSM_LIBRARIES)
diff --git a/gr-vocoder/CMakeLists.txt b/gr-vocoder/CMakeLists.txt
index ddf3684..56ba2a9 100644
--- a/gr-vocoder/CMakeLists.txt
+++ b/gr-vocoder/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2011,2016 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -104,6 +104,14 @@ if(LIBCODEC2_FOUND)
endif(LIBCODEC2_FOUND)
########################################################################
+## GSM Support
+########################################################################
+find_package(GSM)
+if(LIBGSM_FOUND)
+ GR_APPEND_SUBCOMPONENT("gsm")
+endif(LIBGSM_FOUND)
+
+########################################################################
# Add subdirectories
########################################################################
add_subdirectory(include/gnuradio/vocoder)
diff --git a/gr-vocoder/examples/CMakeLists.txt
b/gr-vocoder/examples/CMakeLists.txt
index 86cba6d..0957d81 100644
--- a/gr-vocoder/examples/CMakeLists.txt
+++ b/gr-vocoder/examples/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2011,2016 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -29,7 +29,6 @@ GR_PYTHON_INSTALL(
g721_audio_loopback.py
g723_24_audio_loopback.py
g723_40_audio_loopback.py
- gsm_audio_loopback.py
ulaw_audio_loopback.py
DESTINATION ${GR_PKG_VOCODER_EXAMPLES_DIR}
COMPONENT "vocoder_examples"
@@ -42,3 +41,11 @@ if(LIBCODEC2_FOUND)
COMPONENT "vocoder_examples"
)
endif(LIBCODEC2_FOUND)
+if(LIBGSM_FOUND)
+ GR_PYTHON_INSTALL(
+ PROGRAMS
+ gsm_audio_loopback.py
+ DESTINATION ${GR_PKG_VOCODER_EXAMPLES_DIR}
+ COMPONENT "vocoder_examples"
+ )
+endif(LIBGSM_FOUND)
diff --git a/gr-vocoder/grc/CMakeLists.txt b/gr-vocoder/grc/CMakeLists.txt
index 35a585a..e6c8115 100644
--- a/gr-vocoder/grc/CMakeLists.txt
+++ b/gr-vocoder/grc/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2011,2016 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -31,8 +31,6 @@ install(FILES
vocoder_g723_24_encode_sb.xml
vocoder_g723_40_decode_bs.xml
vocoder_g723_40_encode_sb.xml
- vocoder_gsm_fr_decode_ps.xml
- vocoder_gsm_fr_encode_sp.xml
vocoder_ulaw_decode_bs.xml
vocoder_ulaw_encode_sb.xml
DESTINATION ${GRC_BLOCKS_DIR}
@@ -47,3 +45,12 @@ if(LIBCODEC2_FOUND)
COMPONENT "vocoder_python"
)
endif(LIBCODEC2_FOUND)
+
+if(LIBGSM_FOUND)
+ install(FILES
+ vocoder_gsm_fr_decode_ps.xml
+ vocoder_gsm_fr_encode_sp.xml
+ DESTINATION ${GRC_BLOCKS_DIR}
+ COMPONENT "vocoder_python"
+ )
+endif(LIBGSM_FOUND)
diff --git a/gr-vocoder/include/gnuradio/vocoder/CMakeLists.txt
b/gr-vocoder/include/gnuradio/vocoder/CMakeLists.txt
index 6d9bbe8..13efea7 100644
--- a/gr-vocoder/include/gnuradio/vocoder/CMakeLists.txt
+++ b/gr-vocoder/include/gnuradio/vocoder/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012,2013 Free Software Foundation, Inc.
+# Copyright 2012,2013,2016 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -32,14 +32,11 @@ install(FILES
g723_24_encode_sb.h
g723_40_decode_bs.h
g723_40_encode_sb.h
- gsm_fr_decode_ps.h
- gsm_fr_encode_sp.h
ulaw_decode_bs.h
ulaw_encode_sb.h
DESTINATION ${GR_INCLUDE_DIR}/gnuradio/vocoder
COMPONENT "vocoder_devel"
)
-
if(LIBCODEC2_FOUND)
install(FILES
codec2.h
@@ -49,3 +46,11 @@ install(FILES
COMPONENT "vocoder_devel"
)
endif(LIBCODEC2_FOUND)
+if(LIBGSM_FOUND)
+install(FILES
+ gsm_fr_decode_ps.h
+ gsm_fr_encode_sp.h
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/vocoder
+ COMPONENT "vocoder_devel"
+)
+endif(LIBGSM_FOUND)
diff --git a/gr-vocoder/lib/CMakeLists.txt b/gr-vocoder/lib/CMakeLists.txt
index 67939c5..a8fc874 100644
--- a/gr-vocoder/lib/CMakeLists.txt
+++ b/gr-vocoder/lib/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011,2013 Free Software Foundation, Inc.
+# Copyright 2011,2013,2016 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -18,70 +18,6 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Check for system libgsm via CMake variable GR_USE_SYSTEM_LIBGSM ....
-# if undefined, try to find system libgsm library,
-# but if there is no system library use a local copy.
-# if defined True, use system libgsm if found, otherwise do not
-# use a local copy.
-# if defined False, use the local copy
-########################################################################
-if (NOT DEFINED GR_USE_SYSTEM_LIBGSM)
- find_path(LIBGSM_INCLUDE_DIR NAMES gsm.h
- PATHS
- ${LIBGSM_PKG_INCLUDE_DIRS}
- /usr/include/gsm
- /usr/include
- )
-
- find_library(LIBGSM_LIBRARIES NAMES gsm
- PATHS
- ${LIBGSM_PKG_LIBRARY_DIRS}
- /usr/lib
- )
-
- if(LIBGSM_INCLUDE_DIR AND LIBGSM_LIBRARIES)
- set(GR_USE_SYSTEM_LIBGSM TRUE CACHE INTERNAL "System libgsm found")
- message(STATUS "Found libgsm: ${LIBGSM_INCLUDE_DIR}, ${LIBGSM_LIBRARIES}")
- set(GR_USE_LOCAL_LIBGSM FALSE)
- set(GR_USE_SYSTEM_LIBGSM TRUE)
- else(LIBGSM_INCLUDE_DIR AND LIBGSM_LIBRARIES)
- set(GR_USE_SYSTEM_LIBGSM FALSE CACHE INTERNAL "System libgsm found")
- message(STATUS "System libgsm not found.")
- set(GR_USE_LOCAL_LIBGSM TRUE)
- endif(LIBGSM_INCLUDE_DIR AND LIBGSM_LIBRARIES)
-else (NOT DEFINED GR_USE_SYSTEM_LIBGSM)
- if (GR_USE_SYSTEM_LIBGSM)
- find_path(LIBGSM_INCLUDE_DIR NAMES gsm.h
- PATHS
- ${LIBGSM_PKG_INCLUDE_DIRS}
- /usr/include/gsm
- /usr/include
- )
-
- find_library(LIBGSM_LIBRARIES NAMES gsm
- PATHS
- ${LIBGSM_PKG_LIBRARY_DIRS}
- /usr/lib
- )
-
- if(LIBGSM_INCLUDE_DIR AND LIBGSM_LIBRARIES)
- set(GR_USE_SYSTEM_LIBGSM TRUE CACHE INTERNAL "System libgsm found")
- message(STATUS "Found libgsm: ${LIBGSM_INCLUDE_DIR}, ${LIBGSM_LIBRARIES}")
- set(GR_USE_LOCAL_LIBGSM FALSE)
- else(LIBGSM_INCLUDE_DIR AND LIBGSM_LIBRARIES)
- set(GR_USE_SYSTEM_LIBGSM FALSE CACHE INTERNAL "System libgsm found")
- message(STATUS "System libgsm not found.")
- set(GR_USE_LOCAL_LIBGSM FALSE)
- endif(LIBGSM_INCLUDE_DIR AND LIBGSM_LIBRARIES)
- else (GR_USE_SYSTEM_LIBGSM)
- set(GR_USE_LOCAL_LIBGSM TRUE)
- message(STATUS "Using gnuradio local copy of libgsm.")
- endif (GR_USE_SYSTEM_LIBGSM)
-endif (NOT DEFINED GR_USE_SYSTEM_LIBGSM)
-
-mark_as_advanced(LIBGSM_INCLUDE_DIR LIBGSM_LIBRARIES)
-
-########################################################################
# Setup the include and linker paths
########################################################################
include_directories(
@@ -115,8 +51,6 @@ list(APPEND gr_vocoder_sources
g723_24_encode_sb_impl.cc
g723_40_decode_bs_impl.cc
g723_40_encode_sb_impl.cc
- gsm_fr_decode_ps_impl.cc
- gsm_fr_encode_sp_impl.cc
ulaw_decode_bs_impl.cc
ulaw_encode_sb_impl.cc
)
@@ -127,6 +61,12 @@ if(LIBCODEC2_FOUND)
codec2_encode_sp_impl.cc
)
endif(LIBCODEC2_FOUND)
+if(LIBGSM_FOUND)
+ list(APPEND gr_vocoder_sources
+ gsm_fr_decode_ps_impl.cc
+ gsm_fr_encode_sp_impl.cc
+ )
+endif(LIBGSM_FOUND)
#Add Windows DLL resource file if using MSVC
if(MSVC)
@@ -147,10 +87,6 @@ endif(MSVC)
########################################################################
GR_INCLUDE_SUBDIRECTORY(g7xx)
-if(GR_USE_LOCAL_LIBGSM)
- GR_INCLUDE_SUBDIRECTORY(gsm)
-endif(GR_USE_LOCAL_LIBGSM)
-
list(APPEND vocoder_libs
gnuradio-runtime
${Boost_LIBRARIES}
@@ -161,9 +97,9 @@ if(LIBCODEC2_LIBRARIES)
list(APPEND vocoder_libs ${LIBCODEC2_LIBRARIES})
endif(LIBCODEC2_LIBRARIES)
-if(GR_USE_SYSTEM_LIBGSM)
+if(LIBGSM_LIBRARIES)
list(APPEND vocoder_libs ${LIBGSM_LIBRARIES})
-endif(GR_USE_SYSTEM_LIBGSM)
+endif(LIBGSM_LIBRARIES)
add_library(gnuradio-vocoder SHARED ${gr_vocoder_sources})
target_link_libraries(gnuradio-vocoder ${vocoder_libs})
diff --git a/gr-vocoder/lib/gsm_fr_decode_ps_impl.cc
b/gr-vocoder/lib/gsm_fr_decode_ps_impl.cc
index 97fbc1b..4bf85ac 100644
--- a/gr-vocoder/lib/gsm_fr_decode_ps_impl.cc
+++ b/gr-vocoder/lib/gsm_fr_decode_ps_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005,2010,2013 Free Software Foundation, Inc.
+ * Copyright 2005,2010,2013,2016 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -24,6 +24,7 @@
#include "config.h"
#endif
+#define GSM_SAMPLES_PER_FRAME 160
#include "gsm_fr_decode_ps_impl.h"
#include <gnuradio/io_signature.h>
#include <stdexcept>
diff --git a/gr-vocoder/lib/gsm_fr_encode_sp_impl.cc
b/gr-vocoder/lib/gsm_fr_encode_sp_impl.cc
index 0c3afe8..9cbd4da 100644
--- a/gr-vocoder/lib/gsm_fr_encode_sp_impl.cc
+++ b/gr-vocoder/lib/gsm_fr_encode_sp_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005,2010,2013 Free Software Foundation, Inc.
+ * Copyright 2005,2010,2013,2016 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -24,6 +24,7 @@
#include "config.h"
#endif
+#define GSM_SAMPLES_PER_FRAME 160
#include "gsm_fr_encode_sp_impl.h"
#include <gnuradio/io_signature.h>
#include <stdexcept>
diff --git a/gr-vocoder/python/vocoder/CMakeLists.txt
b/gr-vocoder/python/vocoder/CMakeLists.txt
index 1626df1..02a4320 100644
--- a/gr-vocoder/python/vocoder/CMakeLists.txt
+++ b/gr-vocoder/python/vocoder/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2011,2016 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -48,7 +48,6 @@ if(ENABLE_TESTING)
qa_g721_vocoder.py
qa_g723_24_vocoder.py
qa_g723_40_vocoder.py
- qa_gsm_full_rate.py
qa_ulaw_vocoder.py
)
if(LIBCODEC2_FOUND)
@@ -56,6 +55,11 @@ if(ENABLE_TESTING)
qa_codec2_vocoder.py
)
endif()
+ if(LIBGSM_FOUND)
+ list(APPEND py_qa_test_files
+ qa_gsm_full_rate.py
+ )
+ endif()
foreach(py_qa_test_file ${py_qa_test_files})
get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
${py_qa_test_file})
diff --git a/gr-vocoder/swig/CMakeLists.txt b/gr-vocoder/swig/CMakeLists.txt
index 6ba2951..3eb7a83 100644
--- a/gr-vocoder/swig/CMakeLists.txt
+++ b/gr-vocoder/swig/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2011,2016 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -37,6 +37,10 @@ if(LIBCODEC2_FOUND)
list(APPEND GR_SWIG_FLAGS "-DLIBCODEC2_FOUND")
endif(LIBCODEC2_FOUND)
+if(LIBGSM_FOUND)
+ list(APPEND GR_SWIG_FLAGS "-DLIBGSM_FOUND")
+endif(LIBGSM_FOUND)
+
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/vocoder_swig_doc.i)
set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/vocoder)
set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc)
diff --git a/gr-vocoder/swig/vocoder_swig.i b/gr-vocoder/swig/vocoder_swig.i
index 22aad98..43d0d1f 100644
--- a/gr-vocoder/swig/vocoder_swig.i
+++ b/gr-vocoder/swig/vocoder_swig.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2011,2013 Free Software Foundation, Inc.
+ * Copyright 2011,2013,2016 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -38,8 +38,6 @@
#include "gnuradio/vocoder/g723_24_encode_sb.h"
#include "gnuradio/vocoder/g723_40_decode_bs.h"
#include "gnuradio/vocoder/g723_40_encode_sb.h"
-#include "gnuradio/vocoder/gsm_fr_decode_ps.h"
-#include "gnuradio/vocoder/gsm_fr_encode_sp.h"
#include "gnuradio/vocoder/ulaw_decode_bs.h"
#include "gnuradio/vocoder/ulaw_encode_sb.h"
%}
@@ -54,8 +52,6 @@
%include "gnuradio/vocoder/g723_24_encode_sb.h"
%include "gnuradio/vocoder/g723_40_decode_bs.h"
%include "gnuradio/vocoder/g723_40_encode_sb.h"
-%include "gnuradio/vocoder/gsm_fr_decode_ps.h"
-%include "gnuradio/vocoder/gsm_fr_encode_sp.h"
%include "gnuradio/vocoder/ulaw_decode_bs.h"
%include "gnuradio/vocoder/ulaw_encode_sb.h"
@@ -69,8 +65,6 @@ GR_SWIG_BLOCK_MAGIC2(vocoder, g723_24_decode_bs);
GR_SWIG_BLOCK_MAGIC2(vocoder, g723_24_encode_sb);
GR_SWIG_BLOCK_MAGIC2(vocoder, g723_40_decode_bs);
GR_SWIG_BLOCK_MAGIC2(vocoder, g723_40_encode_sb);
-GR_SWIG_BLOCK_MAGIC2(vocoder, gsm_fr_decode_ps);
-GR_SWIG_BLOCK_MAGIC2(vocoder, gsm_fr_encode_sp);
GR_SWIG_BLOCK_MAGIC2(vocoder, ulaw_decode_bs);
GR_SWIG_BLOCK_MAGIC2(vocoder, ulaw_encode_sb);
@@ -90,3 +84,16 @@ GR_SWIG_BLOCK_MAGIC2(vocoder, ulaw_encode_sb);
GR_SWIG_BLOCK_MAGIC2(vocoder, codec2_decode_ps);
GR_SWIG_BLOCK_MAGIC2(vocoder, codec2_encode_sp);
#endif
+
+#ifdef LIBGSM_FOUND
+%{
+#include "gnuradio/vocoder/gsm_fr_decode_ps.h"
+#include "gnuradio/vocoder/gsm_fr_encode_sp.h"
+%}
+
+%include "gnuradio/vocoder/gsm_fr_decode_ps.h"
+%include "gnuradio/vocoder/gsm_fr_encode_sp.h"
+
+GR_SWIG_BLOCK_MAGIC2(vocoder, gsm_fr_decode_ps);
+GR_SWIG_BLOCK_MAGIC2(vocoder, gsm_fr_encode_sp);
+#endif
- [Commit-gnuradio] [gnuradio] branch next updated (77f902e -> 675afc0), git, 2016/08/03
- [Commit-gnuradio] [gnuradio] 09/10: Merge remote-tracking branch 'github/require-logging' into next, git, 2016/08/03
- [Commit-gnuradio] [gnuradio] 07/10: vocoder: fix python QA after unembed, git, 2016/08/03
- [Commit-gnuradio] [gnuradio] 08/10: Merge remote-tracking branch 'github/vocoder-unembed' into next, git, 2016/08/03
- [Commit-gnuradio] [gnuradio] 03/10: gr-vocoder: gsm subcomponent using external gsm library,
git <=
- [Commit-gnuradio] [gnuradio] 01/10: gr-vocoder: codec2 subcomponent using external codec2 library, git, 2016/08/03
- [Commit-gnuradio] [gnuradio] 05/10: cmake: remove ENABLE_GR_LOG and require log4cpp, git, 2016/08/03
- [Commit-gnuradio] [gnuradio] 10/10: Merge remote-tracking branch 'github/nuke-cpack' into next, git, 2016/08/03
- [Commit-gnuradio] [gnuradio] 04/10: gr-vocoder: remove embedded gsm, git, 2016/08/03
- [Commit-gnuradio] [gnuradio] 06/10: cmake: nuke cpack from existence, git, 2016/08/03
- [Commit-gnuradio] [gnuradio] 02/10: gr-vocoder: remove embedded codec2, git, 2016/08/03