Skip to content

Commit

Permalink
Merge branch 'master' into license-update
Browse files Browse the repository at this point in the history
  • Loading branch information
jgaeddert committed May 9, 2015
2 parents 3805fdb + 3973166 commit a51edc5
Show file tree
Hide file tree
Showing 54 changed files with 4,725 additions and 1,959 deletions.
132 changes: 79 additions & 53 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ AC_LANG(C)

# Autoheader
AH_TEMPLATE([LIQUID_FFTOVERRIDE], [Force internal FFT even if libfftw is available])
AH_TEMPLATE([LIQUID_SIMDOVERRIDE], [Force overriding of SIMD (use portable C code)])

AC_CONFIG_HEADER(config.h)
AH_TOP([
Expand All @@ -52,6 +53,12 @@ AC_ARG_ENABLE(debug,
[DEBUG_OPTION=""]
)

AC_ARG_ENABLE(simdoverride,
AS_HELP_STRING([--enable-simdoverride],[use portable C code for dotprod, etc. even if SIMD extensions are available]),
[AC_DEFINE(LIQUID_SIMDOVERRIDE)],
[],
)

AC_ARG_ENABLE(fftoverride,
AS_HELP_STRING([--enable-fftoverride],[use internal fft even if libfftw is available]),
[AC_DEFINE(LIQUID_FFTOVERRIDE)],
Expand Down Expand Up @@ -122,63 +129,82 @@ AC_CHECK_SIZEOF(unsigned int)
# $CFLAGS (sets to "unknown" on failure).
AX_GCC_ARCHFLAG([no],[],[])

# Check canonical system
AC_CANONICAL_TARGET
case $target_cpu in
i386|i486|i586|i686|x86|x86_64)
# check for MMX/SSE/AVX CPU extensions and intrinsics headers
# MMX : mmintrin.h
# SSE : xmmintrin.h
# SSE2 : emmintrin.h
# SSE3 : pmmintrin.h
# SSSE3 : tmmintrin.h
# SSE4.1/2: smmintrin.h
# AVX : immintrin.h
AX_EXT

if [ test "$ax_cv_have_sse41_ext" = yes && test "$ac_cv_header_smmintrin_h" = yes ]; then
# SSE4.1/2 extensions
MLIBS_DOTPROD="src/dotprod/src/dotprod_cccf.mmx.o \
src/dotprod/src/dotprod_crcf.mmx.o \
src/dotprod/src/dotprod_rrrf.mmx.o \
src/dotprod/src/sumsq.mmx.o"
elif [ test "$ax_cv_have_sse2_ext" = yes && test "$ac_cv_header_emmintrin_h" = yes ]; then
# SSE2 extensions
MLIBS_DOTPROD="src/dotprod/src/dotprod_cccf.mmx.o \
src/dotprod/src/dotprod_crcf.mmx.o \
src/dotprod/src/dotprod_rrrf.mmx.o \
src/dotprod/src/sumsq.mmx.o"
else
# portable C version
MLIBS_DOTPROD="src/dotprod/src/dotprod_cccf.o \
src/dotprod/src/dotprod_crcf.o \
src/dotprod/src/dotprod_rrrf.o \
src/dotprod/src/sumsq.o"
fi;;
powerpc*)
MLIBS_DOTPROD="src/dotprod/src/dotprod_cccf.o \
src/dotprod/src/dotprod_rrrf.av.o \
src/dotprod/src/dotprod_crcf.av.o \
src/dotprod/src/sumsq.o"
ARCH_OPTION="-fno-common -faltivec";;
arm*)
# TODO: check for Neon availability

# ARM architecture : use neon extensions
MLIBS_DOTPROD="src/dotprod/src/dotprod_cccf.neon.o \
src/dotprod/src/dotprod_crcf.neon.o \
src/dotprod/src/dotprod_rrrf.neon.o \
src/dotprod/src/sumsq.o"
# TODO: check these flags
ARCH_OPTION="-ffast-math -mcpu=cortex-a8 -mfloat-abi=softfp -mfpu=neon";;
*)
# unknown architecture : use portable C version
# override SIMD
if test "${enable_simdoverride+set}" = set; then
# portable C version
MLIBS_DOTPROD="src/dotprod/src/dotprod_cccf.o \
src/dotprod/src/dotprod_crcf.o \
src/dotprod/src/dotprod_rrrf.o \
src/dotprod/src/sumsq.o"
ARCH_OPTION="";;
esac
ARCH_OPTION=""
else
# Check canonical system
AC_CANONICAL_TARGET
case $target_cpu in
i386|i486|i586|i686|x86|x86_64)
# check for MMX/SSE/AVX CPU extensions and intrinsics headers
# MMX : mmintrin.h
# SSE : xmmintrin.h
# SSE2 : emmintrin.h
# SSE3 : pmmintrin.h
# SSSE3 : tmmintrin.h
# SSE4.1/2: smmintrin.h
# AVX : immintrin.h
AX_EXT

if [ test "$ax_cv_have_sse41_ext" = yes && test "$ac_cv_header_smmintrin_h" = yes ]; then
# SSE4.1/2 extensions
MLIBS_DOTPROD="src/dotprod/src/dotprod_cccf.mmx.o \
src/dotprod/src/dotprod_crcf.mmx.o \
src/dotprod/src/dotprod_rrrf.mmx.o \
src/dotprod/src/sumsq.mmx.o"
elif [ test "$ax_cv_have_sse2_ext" = yes && test "$ac_cv_header_emmintrin_h" = yes ]; then
# SSE2 extensions
MLIBS_DOTPROD="src/dotprod/src/dotprod_cccf.mmx.o \
src/dotprod/src/dotprod_crcf.mmx.o \
src/dotprod/src/dotprod_rrrf.mmx.o \
src/dotprod/src/sumsq.mmx.o"
else
# portable C version
MLIBS_DOTPROD="src/dotprod/src/dotprod_cccf.o \
src/dotprod/src/dotprod_crcf.o \
src/dotprod/src/dotprod_rrrf.o \
src/dotprod/src/sumsq.o"
fi;;
powerpc*)
MLIBS_DOTPROD="src/dotprod/src/dotprod_cccf.o \
src/dotprod/src/dotprod_rrrf.av.o \
src/dotprod/src/dotprod_crcf.av.o \
src/dotprod/src/sumsq.o"
ARCH_OPTION="-fno-common -faltivec";;
armv1*|armv2*|armv3*|armv4*|armv5*|armv6*)
# assume neon instructions are NOT available
MLIBS_DOTPROD="src/dotprod/src/dotprod_cccf.o \
src/dotprod/src/dotprod_crcf.o \
src/dotprod/src/dotprod_rrrf.o \
src/dotprod/src/sumsq.o"
ARCH_OPTION="-ffast-math";;
armv7*|armv8*)
# assume neon instructions are available
# TODO: check for Neon availability

# ARM architecture : use neon extensions
MLIBS_DOTPROD="src/dotprod/src/dotprod_cccf.neon.o \
src/dotprod/src/dotprod_crcf.neon.o \
src/dotprod/src/dotprod_rrrf.neon.o \
src/dotprod/src/sumsq.o"
# TODO: check these flags
ARCH_OPTION="-ffast-math -mcpu=cortex-a8 -mfloat-abi=softfp -mfpu=neon";;
*)
# unknown architecture : use portable C version
MLIBS_DOTPROD="src/dotprod/src/dotprod_cccf.o \
src/dotprod/src/dotprod_crcf.o \
src/dotprod/src/dotprod_rrrf.o \
src/dotprod/src/sumsq.o"
ARCH_OPTION="";;
esac
fi


# for now all vector operations are portable C versions
MLIBS_VECTOR="src/vector/src/vectorf_add.port.o \
Expand Down
13 changes: 13 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,20 @@ This directory contains all the examples for interfacing the liquid modules.

SEE ALSO: `polyfit_example.c`

* `qdetector_cccf_example.c`:
This example demonstrates the functionality of the qdetector object
to detect an arbitrary signal in time in the presence of noise,
carrier frequency/phase offsets, and fractional-sample timing
offsets.

* `qpacketmodem_example.c`:
This example demonstrates the basic packet modem encoder/decoder
operation. A packet of data is encoded and modulated into symbols,
channel noise is added, and the resulting packet is demodulated
and decoded.

* `qnsearch_example.c`:

* `quantize_example.c`:

* `random_histogram_example.c`:
Expand Down
50 changes: 21 additions & 29 deletions examples/flexframesync_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

void usage()
{
printf("ofdmflexframesync_example [options]\n");
printf("flexframesync_example [options]\n");
printf(" u/h : print usage\n");
printf(" s : signal-to-noise ratio [dB], default: 20\n");
printf(" F : carrier frequency offset, default: 0.01\n");
Expand All @@ -53,7 +53,7 @@ static int callback(unsigned char * _header,

int main(int argc, char *argv[])
{
srand( time(NULL) );
//srand( time(NULL) );

// options
modulation_scheme ms = LIQUID_MODEM_QPSK; // mod. scheme
Expand Down Expand Up @@ -105,7 +105,6 @@ int main(int argc, char *argv[])

// create flexframesync object
flexframesync fs = flexframesync_create(callback,NULL);
flexframesync_print(fs);
if (debug_enabled)
flexframesync_debug_enable(fs);

Expand All @@ -119,43 +118,36 @@ int main(int argc, char *argv[])
flexframegen_assemble(fg, header, payload, payload_len);
flexframegen_print(fg);

// generate the frame
unsigned int frame_len = flexframegen_getframelen(fg);
unsigned int num_samples = frame_len + 100;
printf("frame length : %u samples\n", frame_len);
float complex x[num_samples];
float complex y[num_samples];
// generate the frame in blocks
unsigned int buf_len = 256;
float complex x[buf_len];
float complex y[buf_len];

int frame_complete = 0;
unsigned int n;
for (n=0; n<50; n++)
x[n] = 0.0f;
float phi = 0.0f;
while (!frame_complete) {
//printf("assert %6u < %6u\n", n, num_samples);
assert(n < num_samples);
frame_complete = flexframegen_write_samples(fg, &x[n]);
n += 2;
}
for (; n<num_samples; n++)
x[n] = 0.0f;
assert(n == num_samples);
// write samples to buffer
frame_complete = flexframegen_write_samples(fg, x, buf_len);

// add noise and push through synchronizer
for (i=0; i<num_samples; i++) {
// apply channel gain and carrier offset to input
y[i] = gamma * x[i] * cexpf(_Complex_I*dphi*i);
// add noise and push through synchronizer
for (i=0; i<buf_len; i++) {
// apply channel gain and carrier offset to input
y[i] = gamma * x[i] * cexpf(_Complex_I*phi);
phi += dphi;

// add noise
y[i] += nstd*( randnf() + _Complex_I*randnf())*M_SQRT1_2;
}
// add noise
y[i] += nstd*( randnf() + _Complex_I*randnf())*M_SQRT1_2;
}

// run through frame synchronizer
flexframesync_execute(fs, y, num_samples);
// run through frame synchronizer
flexframesync_execute(fs, y, buf_len);
}

// export debugging file
if (debug_enabled)
flexframesync_debug_print(fs, "flexframesync_debug.m");

flexframesync_print(fs);
// destroy allocated objects
flexframegen_destroy(fg);
flexframesync_destroy(fs);
Expand Down
Loading

0 comments on commit a51edc5

Please sign in to comment.