mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-10 16:43:33 +02:00
Convert default resampler from libresample to libsoxr.
This commit is contained in:
23
lib-src/libsoxr/cmake/Modules/FindLibAVCodec.cmake
Normal file
23
lib-src/libsoxr/cmake/Modules/FindLibAVCodec.cmake
Normal file
@@ -0,0 +1,23 @@
|
||||
# SoX Resampler Library Copyright (c) 2007-12 robs@users.sourceforge.net
|
||||
# Licence for this file: LGPL v2.1 See LICENCE for details.
|
||||
|
||||
# - Find AVCODEC
|
||||
# Find the native installation of this package: includes and libraries.
|
||||
#
|
||||
# AVCODEC_INCLUDES - where to find headers for this package.
|
||||
# AVCODEC_LIBRARIES - List of libraries when using this package.
|
||||
# AVCODEC_FOUND - True if this package can be found.
|
||||
|
||||
if (AVCODEC_INCLUDES)
|
||||
set (AVCODEC_FIND_QUIETLY TRUE)
|
||||
endif (AVCODEC_INCLUDES)
|
||||
|
||||
find_path (AVCODEC_INCLUDES libavcodec/avcodec.h)
|
||||
|
||||
find_library (AVCODEC_LIBRARIES NAMES avcodec)
|
||||
|
||||
include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (
|
||||
AVCODEC DEFAULT_MSG AVCODEC_LIBRARIES AVCODEC_INCLUDES)
|
||||
|
||||
mark_as_advanced (AVCODEC_LIBRARIES AVCODEC_INCLUDES)
|
91
lib-src/libsoxr/cmake/Modules/FindOpenMP.cmake
Normal file
91
lib-src/libsoxr/cmake/Modules/FindOpenMP.cmake
Normal file
@@ -0,0 +1,91 @@
|
||||
# - Finds OpenMP support
|
||||
# This module can be used to detect OpenMP support in a compiler.
|
||||
# If the compiler supports OpenMP, the flags required to compile with
|
||||
# openmp support are set.
|
||||
#
|
||||
# The following variables are set:
|
||||
# OpenMP_C_FLAGS - flags to add to the C compiler for OpenMP support
|
||||
# OPENMP_FOUND - true if openmp is detected
|
||||
#
|
||||
# Supported compilers can be found at http://openmp.org/wp/openmp-compilers/
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2009 Kitware, Inc.
|
||||
# Copyright 2008-2009 André Rigland Brodtkorb <Andre.Brodtkorb@ifi.uio.no>
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
include(CheckCSourceCompiles)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
set(OpenMP_C_FLAG_CANDIDATES
|
||||
#Gnu
|
||||
"-fopenmp"
|
||||
#Microsoft Visual Studio
|
||||
"/openmp"
|
||||
#Intel windows
|
||||
"-Qopenmp"
|
||||
#Intel
|
||||
"-openmp"
|
||||
#Empty, if compiler automatically accepts openmp
|
||||
" "
|
||||
#Sun
|
||||
"-xopenmp"
|
||||
#HP
|
||||
"+Oopenmp"
|
||||
#IBM XL C/c++
|
||||
"-qsmp"
|
||||
#Portland Group
|
||||
"-mp"
|
||||
)
|
||||
|
||||
# sample openmp source code to test
|
||||
set(OpenMP_C_TEST_SOURCE
|
||||
"
|
||||
#include <omp.h>
|
||||
int main() {
|
||||
#ifdef _OPENMP
|
||||
return 0;
|
||||
#else
|
||||
breaks_on_purpose
|
||||
#endif
|
||||
}
|
||||
")
|
||||
# if these are set then do not try to find them again,
|
||||
# by avoiding any try_compiles for the flags
|
||||
if(DEFINED OpenMP_C_FLAGS)
|
||||
set(OpenMP_C_FLAG_CANDIDATES)
|
||||
endif(DEFINED OpenMP_C_FLAGS)
|
||||
|
||||
# check c compiler
|
||||
foreach(FLAG ${OpenMP_C_FLAG_CANDIDATES})
|
||||
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||
set(CMAKE_REQUIRED_FLAGS "${FLAG}")
|
||||
unset(OpenMP_FLAG_DETECTED CACHE)
|
||||
message(STATUS "Try OpenMP C flag = [${FLAG}]")
|
||||
check_c_source_compiles("${OpenMP_C_TEST_SOURCE}" OpenMP_FLAG_DETECTED)
|
||||
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
|
||||
if(OpenMP_FLAG_DETECTED)
|
||||
set(OpenMP_C_FLAGS_INTERNAL "${FLAG}")
|
||||
break()
|
||||
endif(OpenMP_FLAG_DETECTED)
|
||||
endforeach(FLAG ${OpenMP_C_FLAG_CANDIDATES})
|
||||
|
||||
set(OpenMP_C_FLAGS "${OpenMP_C_FLAGS_INTERNAL}"
|
||||
CACHE STRING "C compiler flags for OpenMP parallization")
|
||||
|
||||
# handle the standard arguments for find_package
|
||||
find_package_handle_standard_args(OpenMP DEFAULT_MSG
|
||||
OpenMP_C_FLAGS OpenMP_C_FLAGS )
|
||||
|
||||
mark_as_advanced(
|
||||
OpenMP_C_FLAGS
|
||||
)
|
53
lib-src/libsoxr/cmake/Modules/FindSIMD.cmake
Normal file
53
lib-src/libsoxr/cmake/Modules/FindSIMD.cmake
Normal file
@@ -0,0 +1,53 @@
|
||||
# - Finds SIMD support
|
||||
#
|
||||
# The following variables are set:
|
||||
# SIMD_C_FLAGS - flags to add to the C compiler for this package.
|
||||
# SIMD_FOUND - true if support for this package is found.
|
||||
|
||||
include (CheckCSourceCompiles)
|
||||
include (FindPackageHandleStandardArgs)
|
||||
|
||||
set(SIMD_C_FLAG_CANDIDATES
|
||||
#Microsoft Visual Studio
|
||||
"/arch:SSE /fp:fast -D__SSE__"
|
||||
#Gnu
|
||||
"-msse -mfpmath=sse"
|
||||
)
|
||||
|
||||
set(SIMD_C_TEST_SOURCE
|
||||
"
|
||||
#include <xmmintrin.h>
|
||||
int main ()
|
||||
{
|
||||
__m128 a, b;
|
||||
float vals[4] = {0};
|
||||
a = _mm_loadu_ps (vals);
|
||||
b = a;
|
||||
b = _mm_add_ps (a,b);
|
||||
_mm_storeu_ps (vals,b);
|
||||
return 0;
|
||||
}
|
||||
")
|
||||
|
||||
if (DEFINED SIMD_C_FLAGS)
|
||||
set (SIMD_C_FLAG_CANDIDATES)
|
||||
endif ()
|
||||
|
||||
foreach (FLAG ${SIMD_C_FLAG_CANDIDATES})
|
||||
set (SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||
set (CMAKE_REQUIRED_FLAGS "${FLAG}")
|
||||
unset (SIMD_FLAG_DETECTED CACHE)
|
||||
message (STATUS "Try SIMD C flag = [${FLAG}]")
|
||||
check_c_source_compiles("${SIMD_C_TEST_SOURCE}" SIMD_FLAG_DETECTED)
|
||||
set (CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
|
||||
if (SIMD_FLAG_DETECTED)
|
||||
set (SIMD_C_FLAGS_INTERNAL "${FLAG}")
|
||||
break ()
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
set (SIMD_C_FLAGS "${SIMD_C_FLAGS_INTERNAL}"
|
||||
CACHE STRING "C compiler flags for SIMD vectorization")
|
||||
|
||||
find_package_handle_standard_args (SIMD DEFAULT_MSG SIMD_C_FLAGS SIMD_C_FLAGS)
|
||||
mark_as_advanced (SIMD_C_FLAGS)
|
Reference in New Issue
Block a user