Clean up redundant internal FFTW3 support; liquid-dsp will use FFTW3 if compiled in.

This commit is contained in:
Charles J. Cliffe 2016-07-20 18:43:54 -04:00
parent 8826547f38
commit 117f56dd9e
15 changed files with 0 additions and 1702 deletions

View File

@ -38,13 +38,6 @@ ADD_DEFINITIONS(
ENDIF()
ENDIF()
SET (ENABLE_FFTW3 OFF CACHE BOOL "Use fftw3 instead of liquid-dsp internal fft.")
IF(ENABLE_FFTW3)
ADD_DEFINITIONS(
-DUSE_FFTW3=1
)
ENDIF()
set(USE_HAMLIB OFF CACHE BOOL "Support hamlib for radio control functions.")
if (USE_HAMLIB)
@ -111,11 +104,6 @@ SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR}/${EX_PLATFORM_
IF (MSVC)
include_directories ("${PROJECT_SOURCE_DIR}/external/wglext")
IF(ENABLE_FFTW3)
SET(FFTW_INCLUDES "${PROJECT_SOURCE_DIR}/external/fftw-3.3.4/" CACHE STRING "FFTW Include Directory")
SET(FFTW_LIBRARIES "${PROJECT_SOURCE_DIR}/external/fftw-3.3.4/${EX_PLATFORM}/libfftw3f-3.lib" CACHE STRING "FFTW Library")
SET(FFTW_DLL "${PROJECT_SOURCE_DIR}/external/fftw-3.3.4/${EX_PLATFORM}/libfftw3f-3.dll" CACHE STRING "FFTW DLL")
ENDIF()
SET(LIQUID_INCLUDES "${PROJECT_SOURCE_DIR}/external/liquid-dsp/include/" CACHE STRING "Liquid-DSP include directory")
SET(LIQUID_LIBRARIES "${PROJECT_SOURCE_DIR}/external/liquid-dsp/msvc/${EX_PLATFORM}/libliquid.lib" CACHE STRING "Liquid-DSP Library")
SET(LIQUID_DLL "${PROJECT_SOURCE_DIR}/external/liquid-dsp/msvc/${EX_PLATFORM}/libliquid.dll" CACHE STRING "Liquid-DSP DLL")
@ -128,13 +116,6 @@ ELSE (MSVC)
ENDIF(MSVC)
find_package(OpenGL REQUIRED)
IF(ENABLE_FFTW3)
find_package(FFTW REQUIRED)
include_directories(${FFTW_INCLUDES})
SET(OTHER_LIBRARIES ${OTHER_LIBRARIES} ${FFTW_LIBRARIES})
ENDIF()
find_package(Liquid REQUIRED)
include_directories(${LIQUID_INCLUDES})
SET(OTHER_LIBRARIES ${OTHER_LIBRARIES} ${LIQUID_LIBRARIES})
@ -202,10 +183,6 @@ IF (UNIX AND NOT APPLE)
SET(USE_AUDIO_ALSA OFF CACHE BOOL "Use ALSA Audio")
SET(USE_AUDIO_OSS OFF CACHE BOOL "Use OSS Audio")
IF(ENABLE_FFTW3)
SET(FFTW_LIB fftw3f)
ENDIF()
SET(LIQUID_LIB liquid)
SET(OTHER_LIBRARIES ${OTHER_LIBRARIES} dl)
@ -247,10 +224,6 @@ ENDIF(UNIX AND NOT APPLE)
IF (APPLE)
SET(CMAKE_OSX_DEPLOYMENT_TARGET, "10.9")
IF(ENABLE_FFTW3)
SET(FFTW_LIB fftw3f)
ENDIF()
SET(LIQUID_LIB liquid)
link_directories(/usr/local/lib)
link_directories(/opt/local/lib)
@ -586,15 +559,9 @@ IF (NOT BUNDLE_APP)
configure_files(${PROJECT_SOURCE_DIR}/font ${CMAKE_BINARY_DIR}/${EX_PLATFORM_NAME}/fonts "*.png")
configure_files(${PROJECT_SOURCE_DIR}/icon ${CMAKE_BINARY_DIR}/${EX_PLATFORM_NAME} CubicSDR.ico)
IF(MSVC)
IF(ENABLE_FFTW3)
configure_files(${PROJECT_SOURCE_DIR}/external/fftw-3.3.4/${EX_PLATFORM}/ ${CMAKE_BINARY_DIR}/${EX_PLATFORM_NAME} "*.dll")
ENDIF()
configure_files(${PROJECT_SOURCE_DIR}/external/liquid-dsp/msvc/${EX_PLATFORM}/ ${CMAKE_BINARY_DIR}/${EX_PLATFORM_NAME} "*.dll")
ENDIF()
add_executable(CubicSDR ${cubicsdr_sources} ${cubicsdr_headers} ${RES_FILES})
IF(ENABLE_FFTW3)
target_link_libraries(CubicSDR ${FFTW_LIB})
ENDIF()
target_link_libraries(CubicSDR ${LIQUID_LIB} ${wxWidgets_LIBRARIES} ${OPENGL_LIBRARIES} ${OTHER_LIBRARIES})
ENDIF (NOT BUNDLE_APP)
@ -666,10 +633,6 @@ IF (APPLE AND BUNDLE_APP)
MACOSX_PACKAGE_LOCATION Resources/fonts
)
IF(ENABLE_FFTW3)
target_link_libraries(CubicSDR ${FFTW_LIB})
ENDIF()
target_link_libraries(CubicSDR ${LIQUID_LIB} ${wxWidgets_LIBRARIES} ${OPENGL_LIBRARIES} ${OTHER_LIBRARIES})
SET_TARGET_PROPERTIES(CubicSDR PROPERTIES
MACOSX_BUNDLE TRUE
@ -811,12 +774,6 @@ IF (WIN32 AND NOT BUILD_INSTALLER)
${LIQUID_DLL}
DESTINATION bin)
IF(ENABLE_FFTW3)
INSTALL(FILES
${FFTW_DLL}
DESTINATION bin)
ENDIF()
IF(USE_HAMLIB)
FOREACH(HAMLIB_DLL ${HAMLIB_DLLS})
message(STATUS "Copying Hamlib DLL: ${HAMLIB_DLL}")
@ -879,13 +836,6 @@ IF (WIN32 AND BUILD_INSTALLER)
ENDFOREACH()
ENDIF()
IF(ENABLE_FFTW3)
install(FILES
${FFTW_DLL}
DESTINATION .)
ENDIF()
IF (BUNDLE_SOAPY_MODS)
ADD_DEFINITIONS(
-DBUNDLE_SOAPY_MODS=1
@ -927,9 +877,6 @@ IF (UNIX AND NOT APPLE AND BUILD_DEB)
set(CPACK_GENERATOR DEB)
set(CPACK_PACKAGE_NAME "CubicSDR")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS " libwxgtk3.0-0, libpulse0")
IF(ENABLE_FFTW3)
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libfftw3-single3")
ENDIF()
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Charles J. Cliffe <cj@cubicproductions.com>")
SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION "CubicSDR Software Defined Radio application v${CUBICSDR_VERSION}")
SET(CPACK_DEBIAN_PACKAGE_SECTION "comm")

View File

@ -1,22 +0,0 @@
# - Find FFTW
# Find the native FFTW includes and library
#
# FFTW_INCLUDES - where to find fftw3.h
# FFTW_LIBRARIES - List of libraries when using FFTW.
# FFTW_FOUND - True if FFTW found.
if (FFTW_INCLUDES)
# Already in cache, be silent
set (FFTW_FIND_QUIETLY TRUE)
endif (FFTW_INCLUDES)
find_path (FFTW_INCLUDES fftw3.h)
find_library (FFTW_LIBRARIES NAMES fftw3)
# handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if
# all listed variables are TRUE
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (FFTW DEFAULT_MSG FFTW_LIBRARIES FFTW_INCLUDES)
#mark_as_advanced (FFTW_LIBRARIES FFTW_INCLUDES)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,414 +0,0 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* The following statement of license applies *only* to this header file,
* and *not* to the other files distributed with FFTW or derived therefrom:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/***************************** NOTE TO USERS *********************************
*
* THIS IS A HEADER FILE, NOT A MANUAL
*
* If you want to know how to use FFTW, please read the manual,
* online at http://www.fftw.org/doc/ and also included with FFTW.
* For a quick start, see the manual's tutorial section.
*
* (Reading header files to learn how to use a library is a habit
* stemming from code lacking a proper manual. Arguably, it's a
* *bad* habit in most cases, because header files can contain
* interfaces that are not part of the public, stable API.)
*
****************************************************************************/
#ifndef FFTW3_H
#define FFTW3_H
#include <stdio.h>
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/* If <complex.h> is included, use the C99 complex type. Otherwise
define a type bit-compatible with C99 complex */
#if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined(complex) && defined(I)
# define FFTW_DEFINE_COMPLEX(R, C) typedef R _Complex C
#else
# define FFTW_DEFINE_COMPLEX(R, C) typedef R C[2]
#endif
#define FFTW_CONCAT(prefix, name) prefix ## name
#define FFTW_MANGLE_DOUBLE(name) FFTW_CONCAT(fftw_, name)
#define FFTW_MANGLE_FLOAT(name) FFTW_CONCAT(fftwf_, name)
#define FFTW_MANGLE_LONG_DOUBLE(name) FFTW_CONCAT(fftwl_, name)
#define FFTW_MANGLE_QUAD(name) FFTW_CONCAT(fftwq_, name)
/* IMPORTANT: for Windows compilers, you should add a line
*/
#define FFTW_DLL
/*
here and in kernel/ifftw.h if you are compiling/using FFTW as a
DLL, in order to do the proper importing/exporting, or
alternatively compile with -DFFTW_DLL or the equivalent
command-line flag. This is not necessary under MinGW/Cygwin, where
libtool does the imports/exports automatically. */
#if defined(FFTW_DLL) && (defined(_WIN32) || defined(__WIN32__))
/* annoying Windows syntax for shared-library declarations */
# if defined(COMPILING_FFTW) /* defined in api.h when compiling FFTW */
# define FFTW_EXTERN extern __declspec(dllexport)
# else /* user is calling FFTW; import symbol */
# define FFTW_EXTERN extern __declspec(dllimport)
# endif
#else
# define FFTW_EXTERN extern
#endif
enum fftw_r2r_kind_do_not_use_me {
FFTW_R2HC=0, FFTW_HC2R=1, FFTW_DHT=2,
FFTW_REDFT00=3, FFTW_REDFT01=4, FFTW_REDFT10=5, FFTW_REDFT11=6,
FFTW_RODFT00=7, FFTW_RODFT01=8, FFTW_RODFT10=9, FFTW_RODFT11=10
};
struct fftw_iodim_do_not_use_me {
int n; /* dimension size */
int is; /* input stride */
int os; /* output stride */
};
#include <stddef.h> /* for ptrdiff_t */
struct fftw_iodim64_do_not_use_me {
ptrdiff_t n; /* dimension size */
ptrdiff_t is; /* input stride */
ptrdiff_t os; /* output stride */
};
typedef void (*fftw_write_char_func_do_not_use_me)(char c, void *);
typedef int (*fftw_read_char_func_do_not_use_me)(void *);
/*
huge second-order macro that defines prototypes for all API
functions. We expand this macro for each supported precision
X: name-mangling macro
R: real data type
C: complex data type
*/
#define FFTW_DEFINE_API(X, R, C) \
\
FFTW_DEFINE_COMPLEX(R, C); \
\
typedef struct X(plan_s) *X(plan); \
\
typedef struct fftw_iodim_do_not_use_me X(iodim); \
typedef struct fftw_iodim64_do_not_use_me X(iodim64); \
\
typedef enum fftw_r2r_kind_do_not_use_me X(r2r_kind); \
\
typedef fftw_write_char_func_do_not_use_me X(write_char_func); \
typedef fftw_read_char_func_do_not_use_me X(read_char_func); \
\
FFTW_EXTERN void X(execute)(const X(plan) p); \
\
FFTW_EXTERN X(plan) X(plan_dft)(int rank, const int *n, \
C *in, C *out, int sign, unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_dft_1d)(int n, C *in, C *out, int sign, \
unsigned flags); \
FFTW_EXTERN X(plan) X(plan_dft_2d)(int n0, int n1, \
C *in, C *out, int sign, unsigned flags); \
FFTW_EXTERN X(plan) X(plan_dft_3d)(int n0, int n1, int n2, \
C *in, C *out, int sign, unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_many_dft)(int rank, const int *n, \
int howmany, \
C *in, const int *inembed, \
int istride, int idist, \
C *out, const int *onembed, \
int ostride, int odist, \
int sign, unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_guru_dft)(int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
C *in, C *out, \
int sign, unsigned flags); \
FFTW_EXTERN X(plan) X(plan_guru_split_dft)(int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
R *ri, R *ii, R *ro, R *io, \
unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_guru64_dft)(int rank, \
const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
C *in, C *out, \
int sign, unsigned flags); \
FFTW_EXTERN X(plan) X(plan_guru64_split_dft)(int rank, \
const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
R *ri, R *ii, R *ro, R *io, \
unsigned flags); \
\
FFTW_EXTERN void X(execute_dft)(const X(plan) p, C *in, C *out); \
FFTW_EXTERN void X(execute_split_dft)(const X(plan) p, R *ri, R *ii, \
R *ro, R *io); \
\
FFTW_EXTERN X(plan) X(plan_many_dft_r2c)(int rank, const int *n, \
int howmany, \
R *in, const int *inembed, \
int istride, int idist, \
C *out, const int *onembed, \
int ostride, int odist, \
unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_dft_r2c)(int rank, const int *n, \
R *in, C *out, unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_dft_r2c_1d)(int n,R *in,C *out,unsigned flags); \
FFTW_EXTERN X(plan) X(plan_dft_r2c_2d)(int n0, int n1, \
R *in, C *out, unsigned flags); \
FFTW_EXTERN X(plan) X(plan_dft_r2c_3d)(int n0, int n1, \
int n2, \
R *in, C *out, unsigned flags); \
\
\
FFTW_EXTERN X(plan) X(plan_many_dft_c2r)(int rank, const int *n, \
int howmany, \
C *in, const int *inembed, \
int istride, int idist, \
R *out, const int *onembed, \
int ostride, int odist, \
unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_dft_c2r)(int rank, const int *n, \
C *in, R *out, unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_dft_c2r_1d)(int n,C *in,R *out,unsigned flags); \
FFTW_EXTERN X(plan) X(plan_dft_c2r_2d)(int n0, int n1, \
C *in, R *out, unsigned flags); \
FFTW_EXTERN X(plan) X(plan_dft_c2r_3d)(int n0, int n1, \
int n2, \
C *in, R *out, unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_guru_dft_r2c)(int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
R *in, C *out, \
unsigned flags); \
FFTW_EXTERN X(plan) X(plan_guru_dft_c2r)(int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
C *in, R *out, \
unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_guru_split_dft_r2c)( \
int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
R *in, R *ro, R *io, \
unsigned flags); \
FFTW_EXTERN X(plan) X(plan_guru_split_dft_c2r)( \
int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
R *ri, R *ii, R *out, \
unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_guru64_dft_r2c)(int rank, \
const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
R *in, C *out, \
unsigned flags); \
FFTW_EXTERN X(plan) X(plan_guru64_dft_c2r)(int rank, \
const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
C *in, R *out, \
unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_guru64_split_dft_r2c)( \
int rank, const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
R *in, R *ro, R *io, \
unsigned flags); \
FFTW_EXTERN X(plan) X(plan_guru64_split_dft_c2r)( \
int rank, const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
R *ri, R *ii, R *out, \
unsigned flags); \
\
FFTW_EXTERN void X(execute_dft_r2c)(const X(plan) p, R *in, C *out); \
FFTW_EXTERN void X(execute_dft_c2r)(const X(plan) p, C *in, R *out); \
\
FFTW_EXTERN void X(execute_split_dft_r2c)(const X(plan) p, \
R *in, R *ro, R *io); \
FFTW_EXTERN void X(execute_split_dft_c2r)(const X(plan) p, \
R *ri, R *ii, R *out); \
\
FFTW_EXTERN X(plan) X(plan_many_r2r)(int rank, const int *n, \
int howmany, \
R *in, const int *inembed, \
int istride, int idist, \
R *out, const int *onembed, \
int ostride, int odist, \
const X(r2r_kind) *kind, unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_r2r)(int rank, const int *n, R *in, R *out, \
const X(r2r_kind) *kind, unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_r2r_1d)(int n, R *in, R *out, \
X(r2r_kind) kind, unsigned flags); \
FFTW_EXTERN X(plan) X(plan_r2r_2d)(int n0, int n1, R *in, R *out, \
X(r2r_kind) kind0, X(r2r_kind) kind1, \
unsigned flags); \
FFTW_EXTERN X(plan) X(plan_r2r_3d)(int n0, int n1, int n2, \
R *in, R *out, X(r2r_kind) kind0, \
X(r2r_kind) kind1, X(r2r_kind) kind2, \
unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_guru_r2r)(int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
R *in, R *out, \
const X(r2r_kind) *kind, unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_guru64_r2r)(int rank, const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
R *in, R *out, \
const X(r2r_kind) *kind, unsigned flags); \
\
FFTW_EXTERN void X(execute_r2r)(const X(plan) p, R *in, R *out); \
\
FFTW_EXTERN void X(destroy_plan)(X(plan) p); \
FFTW_EXTERN void X(forget_wisdom)(void); \
FFTW_EXTERN void X(cleanup)(void); \
\
FFTW_EXTERN void X(set_timelimit)(double t); \
\
FFTW_EXTERN void X(plan_with_nthreads)(int nthreads); \
FFTW_EXTERN int X(init_threads)(void); \
FFTW_EXTERN void X(cleanup_threads)(void); \
\
FFTW_EXTERN int X(export_wisdom_to_filename)(const char *filename); \
FFTW_EXTERN void X(export_wisdom_to_file)(FILE *output_file); \
FFTW_EXTERN char *X(export_wisdom_to_string)(void); \
FFTW_EXTERN void X(export_wisdom)(X(write_char_func) write_char, \
void *data); \
FFTW_EXTERN int X(import_system_wisdom)(void); \
FFTW_EXTERN int X(import_wisdom_from_filename)(const char *filename); \
FFTW_EXTERN int X(import_wisdom_from_file)(FILE *input_file); \
FFTW_EXTERN int X(import_wisdom_from_string)(const char *input_string); \
FFTW_EXTERN int X(import_wisdom)(X(read_char_func) read_char, void *data); \
\
FFTW_EXTERN void X(fprint_plan)(const X(plan) p, FILE *output_file); \
FFTW_EXTERN void X(print_plan)(const X(plan) p); \
FFTW_EXTERN char *X(sprint_plan)(const X(plan) p); \
\
FFTW_EXTERN void *X(malloc)(size_t n); \
FFTW_EXTERN R *X(alloc_real)(size_t n); \
FFTW_EXTERN C *X(alloc_complex)(size_t n); \
FFTW_EXTERN void X(free)(void *p); \
\
FFTW_EXTERN void X(flops)(const X(plan) p, \
double *add, double *mul, double *fmas); \
FFTW_EXTERN double X(estimate_cost)(const X(plan) p); \
FFTW_EXTERN double X(cost)(const X(plan) p); \
\
FFTW_EXTERN int X(alignment_of)(R *p); \
FFTW_EXTERN const char X(version)[]; \
FFTW_EXTERN const char X(cc)[]; \
FFTW_EXTERN const char X(codelet_optim)[];
/* end of FFTW_DEFINE_API macro */
FFTW_DEFINE_API(FFTW_MANGLE_DOUBLE, double, fftw_complex)
FFTW_DEFINE_API(FFTW_MANGLE_FLOAT, float, fftwf_complex)
FFTW_DEFINE_API(FFTW_MANGLE_LONG_DOUBLE, long double, fftwl_complex)
/* __float128 (quad precision) is a gcc extension on i386, x86_64, and ia64
for gcc >= 4.6 (compiled in FFTW with --enable-quad-precision) */
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) \
&& !(defined(__ICC) || defined(__INTEL_COMPILER)) \
&& (defined(__i386__) || defined(__x86_64__) || defined(__ia64__))
# if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined(complex) && defined(I)
/* note: __float128 is a typedef, which is not supported with the _Complex
keyword in gcc, so instead we use this ugly __attribute__ version.
However, we can't simply pass the __attribute__ version to
FFTW_DEFINE_API because the __attribute__ confuses gcc in pointer
types. Hence redefining FFTW_DEFINE_COMPLEX. Ugh. */
# undef FFTW_DEFINE_COMPLEX
# define FFTW_DEFINE_COMPLEX(R, C) typedef _Complex float __attribute__((mode(TC))) C
# endif
FFTW_DEFINE_API(FFTW_MANGLE_QUAD, __float128, fftwq_complex)
#endif
#define FFTW_FORWARD (-1)
#define FFTW_BACKWARD (+1)
#define FFTW_NO_TIMELIMIT (-1.0)
/* documented flags */
#define FFTW_MEASURE (0U)
#define FFTW_DESTROY_INPUT (1U << 0)
#define FFTW_UNALIGNED (1U << 1)
#define FFTW_CONSERVE_MEMORY (1U << 2)
#define FFTW_EXHAUSTIVE (1U << 3) /* NO_EXHAUSTIVE is default */
#define FFTW_PRESERVE_INPUT (1U << 4) /* cancels FFTW_DESTROY_INPUT */
#define FFTW_PATIENT (1U << 5) /* IMPATIENT is default */
#define FFTW_ESTIMATE (1U << 6)
#define FFTW_WISDOM_ONLY (1U << 21)
/* undocumented beyond-guru flags */
#define FFTW_ESTIMATE_PATIENT (1U << 7)
#define FFTW_BELIEVE_PCOST (1U << 8)
#define FFTW_NO_DFT_R2HC (1U << 9)
#define FFTW_NO_NONTHREADED (1U << 10)
#define FFTW_NO_BUFFERING (1U << 11)
#define FFTW_NO_INDIRECT_OP (1U << 12)
#define FFTW_ALLOW_LARGE_GENERIC (1U << 13) /* NO_LARGE_GENERIC is default */
#define FFTW_NO_RANK_SPLITS (1U << 14)
#define FFTW_NO_VRANK_SPLITS (1U << 15)
#define FFTW_NO_VRECURSE (1U << 16)
#define FFTW_NO_SIMD (1U << 17)
#define FFTW_NO_SLOW (1U << 18)
#define FFTW_NO_FIXED_RADIX_LARGE_N (1U << 19)
#define FFTW_ALLOW_PRUNING (1U << 20)
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif /* FFTW3_H */

View File

@ -9,42 +9,19 @@ ScopeVisualProcessor::ScopeVisualProcessor(): outputBuffers("ScopeVisualProcesso
fft_ceil_ma = fft_ceil_maa = 0;
fft_floor_ma = fft_floor_maa = 0;
maxScopeSamples = 1024;
#if USE_FFTW3
fftw_plan = nullptr;
#else
fftPlan = nullptr;
#endif
}
ScopeVisualProcessor::~ScopeVisualProcessor() {
#if USE_FFTW3
if (fftw_plan) {
fftwf_destroy_plan(fftw_plan);
}
#else
if (fftPlan) {
fft_destroy_plan(fftPlan);
}
#endif
}
void ScopeVisualProcessor::setup(int fftSize_in) {
fftSize = fftSize_in;
desiredInputSize = fftSize;
#if USE_FFTW3
fftInData.resize(fftSize);
fftwOutput.resize(fftSize);
if (fftw_plan) {
fftwf_destroy_plan(fftw_plan);
}
fftw_plan = fftwf_plan_dft_r2c_1d(fftSize, fftInData.data(), fftwOutput.data(), FFTW_ESTIMATE);
#else
fftInData.resize(fftSize);
fftOutput.resize(fftSize);
@ -53,7 +30,6 @@ void ScopeVisualProcessor::setup(int fftSize_in) {
fft_destroy_plan(fftPlan);
}
fftPlan = fft_create_plan(fftSize, fftInData.data(), fftOutput.data(), LIQUID_FFT_FORWARD, 0);
#endif
}
void ScopeVisualProcessor::setScopeEnabled(bool scopeEnable) {
@ -142,26 +118,6 @@ void ScopeVisualProcessor::process() {
if (spectrumEnabled) {
iMax = audioInputData->data.size();
#if USE_FFTW3
if (audioInputData->channels==1) {
for (i = 0; i < fftSize; i++) {
if (i < iMax) {
fftInData[i] = audioInputData->data[i];
} else {
fftInData[i] = 0;
}
}
} else if (audioInputData->channels==2) {
iMax = iMax/2;
for (i = 0; i < fftSize; i++) {
if (i < iMax) {
fftInData[i] = audioInputData->data[i] + audioInputData->data[iMax+i];
} else {
fftInData[i] = 0;
}
}
}
#else
if (audioInputData->channels==1) {
for (i = 0; i < fftSize; i++) {
if (i < iMax) {
@ -184,7 +140,6 @@ void ScopeVisualProcessor::process() {
}
}
}
#endif
renderData = outputBuffers.getBuffer();
@ -202,19 +157,6 @@ void ScopeVisualProcessor::process() {
fft_result_maa.resize((fftSize/2));
}
#if USE_FFTW3
fftwf_execute(fftw_plan);
for (i = 0; i < (fftSize/2); i++) {
//cast result to double to prevent overflows / excessive precision losses in the following computations...
double a = (double) fftwOutput[i][0];
double b = (double) fftwOutput[i][1];
//computes norm = sqrt(a**2 + b**2)
//being actually floats cast into doubles, we are indeed overflow-free here.
fft_result[i] = sqrt(a*a + b*b);
}
#else
fft_execute(fftPlan);
for (i = 0; i < (fftSize/2); i++) {
@ -226,7 +168,6 @@ void ScopeVisualProcessor::process() {
//being actually floats cast into doubles, we are indeed overflow-free here.
fft_result[i] = sqrt(a*a + b*b);
}
#endif
for (i = 0; i < (fftSize/2); i++) {
fft_result_ma[i] += (fft_result[i] - fft_result_ma[i]) * fft_average_rate;

View File

@ -4,10 +4,6 @@
#include "AudioThread.h"
#include "ScopePanel.h"
#if USE_FFTW3
#include "fftw3.h"
#endif
class ScopeRenderData: public ReferenceCounter {
public:
std::vector<float> waveform_points;
@ -36,15 +32,9 @@ protected:
std::atomic_bool scopeEnabled;
std::atomic_bool spectrumEnabled;
#if USE_FFTW3
std::vector<float> fftInData;
std::vector<fftwf_complex> fftwOutput;
std::vector<fftwf_plan> fftw_plan;
#else
std::vector<liquid_float_complex> fftInData;
std::vector<liquid_float_complex> fftOutput;
fftplan fftPlan;
#endif
unsigned int fftSize;
int desiredInputSize;

View File

@ -9,19 +9,11 @@ SpectrumVisualProcessor::SpectrumVisualProcessor() : outputBuffers("SpectrumVisu
resampler = nullptr;
resamplerRatio = 0;
#if USE_FFTW3
fftwInput = nullptr;
fftwOutput = nullptr;
fftInData = nullptr;
fftLastData = nullptr;
fftw_plan = nullptr;
#else
fftInput = nullptr;
fftOutput = nullptr;
fftInData = nullptr;
fftLastData = nullptr;
fftPlan = nullptr;
#endif
is_view.store(false);
fftSize.store(0);
@ -129,42 +121,6 @@ void SpectrumVisualProcessor::setup(unsigned int fftSize_in) {
fftSizeInternal = fftSize_in * SPECTRUM_VZM;
lastDataSize = 0;
#if USE_FFTW3
int memSize = sizeof(fftwf_complex) * fftSizeInternal;
if (fftwInput) {
free(fftwInput);
}
//fftwInput = (fftwf_complex*) fftwf_malloc(memSize);
fftwInput = (fftwf_complex*)malloc(memSize);
memset(fftwInput,0,memSize);
if (fftInData) {
free(fftInData);
}
//fftInData = (fftwf_complex*) fftwf_malloc(memSize);
fftInData = (fftwf_complex*)malloc(memSize);
memset(fftwInput,0,memSize);
if (fftLastData) {
free(fftLastData);
}
//fftLastData = (fftwf_complex*) fftwf_malloc(memSize);
fftLastData = (fftwf_complex*)malloc(memSize);
memset(fftwInput,0,memSize);
if (fftwOutput) {
free(fftwOutput);
}
//fftwOutput = (fftwf_complex*) fftwf_malloc(memSize);
fftwOutput = (fftwf_complex*)malloc(memSize);
memset(fftwInput,0,memSize);
if (fftw_plan) {
fftwf_destroy_plan(fftw_plan);
}
fftw_plan = fftwf_plan_dft_1d(fftSizeInternal, fftwInput, fftwOutput, FFTW_FORWARD, FFTW_ESTIMATE);
#else
int memSize = sizeof(liquid_float_complex) * fftSizeInternal;
if (fftInput) {
@ -195,7 +151,6 @@ void SpectrumVisualProcessor::setup(unsigned int fftSize_in) {
fft_destroy_plan(fftPlan);
}
fftPlan = fft_create_plan(fftSizeInternal, fftInput, fftOutput, LIQUID_FFT_FORWARD, 0);
#endif
}
@ -385,85 +340,26 @@ void SpectrumVisualProcessor::process() {
msresamp_crcf_execute(resampler, &shiftBuffer[0], desired_input_size, &resampleBuffer[0], &num_written);
#if USE_FFTW3
if (num_written < fftSizeInternal) {
for (unsigned int i = 0; i < num_written; i++) {
fftInData[i][0] = resampleBuffer[i].real;
fftInData[i][1] = resampleBuffer[i].imag;
}
for (unsigned int i = num_written; i < fftSizeInternal; i++) {
fftInData[i][0] = 0;
fftInData[i][1] = 0;
}
} else {
for (unsigned int i = 0; i < fftSizeInternal; i++) {
fftInData[i][0] = resampleBuffer[i].real;
fftInData[i][1] = resampleBuffer[i].imag;
}
}
#else
if (num_written < fftSizeInternal) {
memcpy(fftInData, resampleBuffer.data(), num_written * sizeof(liquid_float_complex));
memset(&(fftInData[num_written]), 0, (fftSizeInternal-num_written) * sizeof(liquid_float_complex));
} else {
memcpy(fftInData, resampleBuffer.data(), fftSizeInternal * sizeof(liquid_float_complex));
}
#endif
} else {
this->desiredInputSize.store(fftSizeInternal);
num_written = data->size();
#if USE_FFTW3
if (data->size() < fftSizeInternal) {
for (size_t i = 0, iMax = data->size(); i < iMax; i++) {
fftInData[i][0] = (*data)[i].real;
fftInData[i][1] = (*data)[i].imag;
}
for (size_t i = data->size(); i < fftSizeInternal; i++) {
fftInData[i][0] = 0;
fftInData[i][1] = 0;
}
} else {
for (unsigned int i = 0; i < fftSizeInternal; i++) {
fftInData[i][0] = (*data)[i].real;
fftInData[i][1] = (*data)[i].imag;
}
}
#else
if (data->size() < fftSizeInternal) {
memcpy(fftInData, data->data(), data->size() * sizeof(liquid_float_complex));
memset(&fftInData[data->size()], 0, (fftSizeInternal - data->size()) * sizeof(liquid_float_complex));
} else {
memcpy(fftInData, data->data(), fftSizeInternal * sizeof(liquid_float_complex));
}
#endif
}
bool execute = false;
#if USE_FFTW3
if (num_written >= fftSizeInternal) {
execute = true;
memcpy(fftwInput, fftInData, fftSizeInternal * sizeof(fftwf_complex));
memcpy(fftLastData, fftwInput, fftSizeInternal * sizeof(fftwf_complex));
} else {
if (lastDataSize + num_written < fftSizeInternal) { // priming
unsigned int num_copy = fftSizeInternal - lastDataSize;
if (num_written > num_copy) {
num_copy = num_written;
}
memcpy(fftLastData, fftInData, num_copy * sizeof(fftwf_complex));
lastDataSize += num_copy;
} else {
unsigned int num_last = (fftSizeInternal - num_written);
memcpy(fftwInput, fftLastData + (lastDataSize - num_last), num_last * sizeof(fftwf_complex));
memcpy(fftwInput + num_last, fftInData, num_written * sizeof(fftwf_complex));
memcpy(fftLastData, fftwInput, fftSizeInternal * sizeof(fftwf_complex));
execute = true;
}
}
#else
if (num_written >= fftSizeInternal) {
execute = true;
memcpy(fftInput, fftInData, fftSizeInternal * sizeof(liquid_float_complex));
@ -485,7 +381,6 @@ void SpectrumVisualProcessor::process() {
execute = true;
}
}
#endif
if (execute) {
SpectrumVisualData *output = outputBuffers.getBuffer();
@ -503,22 +398,6 @@ void SpectrumVisualProcessor::process() {
float fft_ceil = 0, fft_floor = 1;
#if USE_FFTW3
fftwf_execute(fftw_plan);
for (int i = 0, iMax = fftSizeInternal / 2; i < iMax; i++) {
float a = fftwOutput[i][0];
float b = fftwOutput[i][1];
float c = sqrt(a * a + b * b);
float x = fftwOutput[fftSizeInternal / 2 + i][0];
float y = fftwOutput[fftSizeInternal / 2 + i][1];
float z = sqrt(x * x + y * y);
fft_result[i] = (z);
fft_result[fftSizeInternal / 2 + i] = (c);
}
#else
fft_execute(fftPlan);
for (int i = 0, iMax = fftSizeInternal / 2; i < iMax; i++) {
@ -533,7 +412,6 @@ void SpectrumVisualProcessor::process() {
fft_result[i] = (z);
fft_result[fftSizeInternal / 2 + i] = (c);
}
#endif
if (newResampler && lastView) {
if (bwDiff < 0) {

View File

@ -4,10 +4,6 @@
#include "DemodDefs.h"
#include <cmath>
#if USE_FFTW3
#include "fftw3.h"
#endif
#define SPECTRUM_VZM 2
#define PEAK_RESET_COUNT 30
@ -68,13 +64,8 @@ private:
long lastBandwidth;
bool lastView;
#if USE_FFTW3
fftwf_complex *fftwInput, *fftwOutput, *fftInData, *fftLastData;
fftwf_plan fftw_plan;
#else
liquid_float_complex *fftInput, *fftOutput, *fftInData, *fftLastData;
fftplan fftPlan;
#endif
unsigned int lastDataSize;