Skip to content

Commit 0631795

Browse files
author
Alexandre Marquet
committed
Initial.
0 parents  commit 0631795

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+20136
-0
lines changed

CMakeLists.txt

+215
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
# Copyright 2011,2012,2014,2016 Free Software Foundation, Inc.
2+
#
3+
# This file is part of GNU Radio
4+
#
5+
# GNU Radio is free software; you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation; either version 3, or (at your option)
8+
# any later version.
9+
#
10+
# GNU Radio is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with GNU Radio; see the file COPYING. If not, write to
17+
# the Free Software Foundation, Inc., 51 Franklin Street,
18+
# Boston, MA 02110-1301, USA.
19+
20+
########################################################################
21+
# Project setup
22+
########################################################################
23+
cmake_minimum_required(VERSION 2.6)
24+
project(gr-lazyviterbi CXX C)
25+
enable_testing()
26+
27+
#install to PyBOMBS target prefix if defined
28+
if(DEFINED ENV{PYBOMBS_PREFIX})
29+
set(CMAKE_INSTALL_PREFIX $ENV{PYBOMBS_PREFIX})
30+
message(STATUS "PyBOMBS installed GNU Radio. Setting CMAKE_INSTALL_PREFIX to $ENV{PYBOMBS_PREFIX}")
31+
endif()
32+
33+
#select the release build type by default to get optimization flags
34+
if(NOT CMAKE_BUILD_TYPE)
35+
set(CMAKE_BUILD_TYPE "Release")
36+
message(STATUS "Build type not specified: defaulting to release.")
37+
endif(NOT CMAKE_BUILD_TYPE)
38+
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
39+
40+
#make sure our local CMake Modules path comes first
41+
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules)
42+
43+
# Set the version information here
44+
set(VERSION_INFO_MAJOR_VERSION 1)
45+
set(VERSION_INFO_API_COMPAT 0)
46+
set(VERSION_INFO_MINOR_VERSION 0)
47+
set(VERSION_INFO_MAINT_VERSION git)
48+
49+
# Set cmake policies.
50+
# This will suppress developer warnings during the cmake process that can occur
51+
# if a newer cmake version than the minimum is used.
52+
53+
if(POLICY CMP0026)
54+
cmake_policy(SET CMP0026 OLD)
55+
endif()
56+
if(POLICY CMP0043)
57+
cmake_policy(SET CMP0043 OLD)
58+
endif()
59+
if(POLICY CMP0045)
60+
cmake_policy(SET CMP0045 OLD)
61+
endif()
62+
if(POLICY CMP0046)
63+
cmake_policy(SET CMP0046 OLD)
64+
endif()
65+
66+
########################################################################
67+
# Compiler specific setup
68+
########################################################################
69+
if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
70+
#http://gcc.gnu.org/wiki/Visibility
71+
add_definitions(-fvisibility=hidden)
72+
endif()
73+
74+
########################################################################
75+
# Find boost
76+
########################################################################
77+
if(UNIX AND EXISTS "/usr/lib64")
78+
list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix
79+
endif(UNIX AND EXISTS "/usr/lib64")
80+
set(Boost_ADDITIONAL_VERSIONS
81+
"1.35.0" "1.35" "1.36.0" "1.36" "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39"
82+
"1.40.0" "1.40" "1.41.0" "1.41" "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44"
83+
"1.45.0" "1.45" "1.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.49.0" "1.49"
84+
"1.50.0" "1.50" "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54"
85+
"1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59"
86+
"1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64"
87+
"1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69"
88+
)
89+
find_package(Boost "1.35" COMPONENTS filesystem system)
90+
91+
if(NOT Boost_FOUND)
92+
message(FATAL_ERROR "Boost required to compile lazyviterbi")
93+
endif()
94+
95+
########################################################################
96+
# Install directories
97+
########################################################################
98+
include(GrPlatform) #define LIB_SUFFIX
99+
set(GR_RUNTIME_DIR bin)
100+
set(GR_LIBRARY_DIR lib${LIB_SUFFIX})
101+
set(GR_INCLUDE_DIR include/lazyviterbi)
102+
set(GR_DATA_DIR share)
103+
set(GR_PKG_DATA_DIR ${GR_DATA_DIR}/${CMAKE_PROJECT_NAME})
104+
set(GR_DOC_DIR ${GR_DATA_DIR}/doc)
105+
set(GR_PKG_DOC_DIR ${GR_DOC_DIR}/${CMAKE_PROJECT_NAME})
106+
set(GR_CONF_DIR etc)
107+
set(GR_PKG_CONF_DIR ${GR_CONF_DIR}/${CMAKE_PROJECT_NAME}/conf.d)
108+
set(GR_LIBEXEC_DIR libexec)
109+
set(GR_PKG_LIBEXEC_DIR ${GR_LIBEXEC_DIR}/${CMAKE_PROJECT_NAME})
110+
set(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks)
111+
112+
########################################################################
113+
# On Apple only, set install name and use rpath correctly, if not already set
114+
########################################################################
115+
if(APPLE)
116+
if(NOT CMAKE_INSTALL_NAME_DIR)
117+
set(CMAKE_INSTALL_NAME_DIR
118+
${CMAKE_INSTALL_PREFIX}/${GR_LIBRARY_DIR} CACHE
119+
PATH "Library Install Name Destination Directory" FORCE)
120+
endif(NOT CMAKE_INSTALL_NAME_DIR)
121+
if(NOT CMAKE_INSTALL_RPATH)
122+
set(CMAKE_INSTALL_RPATH
123+
${CMAKE_INSTALL_PREFIX}/${GR_LIBRARY_DIR} CACHE
124+
PATH "Library Install RPath" FORCE)
125+
endif(NOT CMAKE_INSTALL_RPATH)
126+
if(NOT CMAKE_BUILD_WITH_INSTALL_RPATH)
127+
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE
128+
BOOL "Do Build Using Library Install RPath" FORCE)
129+
endif(NOT CMAKE_BUILD_WITH_INSTALL_RPATH)
130+
endif(APPLE)
131+
132+
########################################################################
133+
# Find gnuradio build dependencies
134+
########################################################################
135+
find_package(CppUnit)
136+
find_package(Doxygen)
137+
138+
# Search for GNU Radio and its components and versions. Add any
139+
# components required to the list of GR_REQUIRED_COMPONENTS (in all
140+
# caps such as FILTER or FFT) and change the version to the minimum
141+
# API compatible version required.
142+
set(GR_REQUIRED_COMPONENTS RUNTIME TRELLIS)
143+
find_package(Gnuradio "3.7.2" REQUIRED)
144+
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules)
145+
include(GrVersion)
146+
147+
if(NOT CPPUNIT_FOUND)
148+
message(FATAL_ERROR "CppUnit required to compile lazyviterbi")
149+
endif()
150+
151+
########################################################################
152+
# Setup doxygen option
153+
########################################################################
154+
if(DOXYGEN_FOUND)
155+
option(ENABLE_DOXYGEN "Build docs using Doxygen" ON)
156+
else(DOXYGEN_FOUND)
157+
option(ENABLE_DOXYGEN "Build docs using Doxygen" OFF)
158+
endif(DOXYGEN_FOUND)
159+
160+
########################################################################
161+
# Setup the include and linker paths
162+
########################################################################
163+
include_directories(
164+
${CMAKE_SOURCE_DIR}/lib
165+
${CMAKE_SOURCE_DIR}/include
166+
${CMAKE_BINARY_DIR}/lib
167+
${CMAKE_BINARY_DIR}/include
168+
${Boost_INCLUDE_DIRS}
169+
${CPPUNIT_INCLUDE_DIRS}
170+
${GNURADIO_ALL_INCLUDE_DIRS}
171+
)
172+
173+
link_directories(
174+
${Boost_LIBRARY_DIRS}
175+
${CPPUNIT_LIBRARY_DIRS}
176+
${GNURADIO_RUNTIME_LIBRARY_DIRS}
177+
)
178+
179+
# Set component parameters
180+
set(GR_LAZYVITERBI_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE INTERNAL "" FORCE)
181+
set(GR_LAZYVITERBI_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/swig CACHE INTERNAL "" FORCE)
182+
183+
########################################################################
184+
# Create uninstall target
185+
########################################################################
186+
configure_file(
187+
${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in
188+
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
189+
@ONLY)
190+
191+
add_custom_target(uninstall
192+
${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
193+
)
194+
195+
########################################################################
196+
# Add subdirectories
197+
########################################################################
198+
add_subdirectory(include/lazyviterbi)
199+
add_subdirectory(lib)
200+
add_subdirectory(swig)
201+
add_subdirectory(python)
202+
add_subdirectory(grc)
203+
add_subdirectory(apps)
204+
add_subdirectory(docs)
205+
206+
########################################################################
207+
# Install cmake search helper for this library
208+
########################################################################
209+
if(NOT CMAKE_MODULES_DIR)
210+
set(CMAKE_MODULES_DIR lib${LIB_SUFFIX}/cmake)
211+
endif(NOT CMAKE_MODULES_DIR)
212+
213+
install(FILES cmake/Modules/lazyviterbiConfig.cmake
214+
DESTINATION ${CMAKE_MODULES_DIR}/lazyviterbi
215+
)

MANIFEST.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
title: LAZY-VITERBI Algorithm
2+
brief: A quicker viterbi algorithm.
3+
tags: # Tags are arbitrary, but look at CGRAN what other authors are using
4+
- sdr, Viterbi
5+
author:
6+
- Alexandre Marquet.
7+
copyright_owner:
8+
- Free Software Foundation, Inc.
9+
license:
10+
#repo:
11+
#website:
12+
#icon:
13+
---
14+
This module contains a single block which is a drop-in replacement for the Viterbi
15+
block of gr-trellis.
16+
It implements the Viterbi algorithm for decoding or equalization in the way described
17+
in Feldman, Jon & Abou-Faycal, Ibrahim & Frigo, Matteo. (2002).
18+
A Fast Maximum-Likelihood Decoder for Convolutional Codes. Vehicular Technology Conference, 1988, IEEE 38th.
19+
10.1109/VETECF.2002.1040367.
20+
21+
This implementation provides a significant speedup at moderate SNRs, but is slower
22+
at low SNR.

README.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# GNURadio implementation of the Lazy Viterbi algorithm.
2+
3+
This module contains a single block which is a drop-in replacement for the Viterbi
4+
block of gr-trellis.
5+
It implements the Viterbi algorithm for decoding or equalization in the way described
6+
in Feldman, Jon & Abou-Faycal, Ibrahim & Frigo, Matteo. (2002).
7+
A Fast Maximum-Likelihood Decoder for Convolutional Codes. Vehicular Technology Conference, 1988, IEEE 38th.
8+
10.1109/VETECF.2002.1040367.
9+
10+
This implementation provides a significant speedup at moderate SNRs, but is slower
11+
at low SNR.
12+
13+
One GRC example is provided in the examples/ directory.
14+
There are also two python scripts :
15+
* `ber_vs_ebn0_75_awgn.py` lets you compare the BER of this algorithm
16+
and the gr-trellis's implementation of the classical Viterbi algorithm for a
17+
transmission AWGN channel with the (7,5) convolutional code (there
18+
should be a slight difference of performance du to metrics quantization from our
19+
implementation) ;
20+
* `bitrate_vs_ebn0.py` compare the speed of this algorithm and the gr-trellis's
21+
implementation of the classical Viterbi algorithm for a transmission AWGN
22+
channel with the (229,159) convolutional code.
23+
The convolutional code used in this script can easily be changed by supplying its
24+
treillis in a FSM file (see gr-trellis documentation), to see what kind of speedup
25+
can be expected for a particular use case.

apps/CMakeLists.txt

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright 2011 Free Software Foundation, Inc.
2+
#
3+
# This file is part of GNU Radio
4+
#
5+
# GNU Radio is free software; you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation; either version 3, or (at your option)
8+
# any later version.
9+
#
10+
# GNU Radio is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with GNU Radio; see the file COPYING. If not, write to
17+
# the Free Software Foundation, Inc., 51 Franklin Street,
18+
# Boston, MA 02110-1301, USA.
19+
20+
include(GrPython)
21+
22+
GR_PYTHON_INSTALL(
23+
PROGRAMS
24+
DESTINATION bin
25+
)

0 commit comments

Comments
 (0)