Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bbc0f63
Showing
89 changed files
with
6,868 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
cmake_minimum_required(VERSION 2.6) | ||
|
||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) | ||
|
||
include(CheckFunctionExists) | ||
set(CMAKE_REQUIRED_LIBRARIES -lm) | ||
check_function_exists(lrintf HAVE_LRINTF) | ||
|
||
add_definitions(-DHAVE_CONFIG_H) | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}) | ||
|
||
option(BUILD_TESTS "Build the test suite" OFF) | ||
option(BUILD_TOOLS "Build standard tools" OFF) | ||
option(BUILD_EXTRA_TOOLS "Build extra tools (only useful for development of this library)" OFF) | ||
|
||
option(WITH_AVFFT "Use FFmpeg for FFT calculations" OFF) | ||
option(WITH_FFTW3 "Use FFTW3 for FFT calculations" OFF) | ||
|
||
find_package(FFmpeg) | ||
find_package(FFTW3) | ||
|
||
if(WITH_AVFFT AND WITH_FFTW3) | ||
message(FATAL_ERROR "Only one of WITH_AVFFT and WITH_FFTW3 can be selected") | ||
endif(WITH_AVFFT AND WITH_FFTW3) | ||
|
||
if(WITH_AVFFT AND NOT FFMPEG_LIBAVCODEC_FFT_FOUND) | ||
message(FATAL_ERROR "FFmpeg with avfft.h not found") | ||
endif(WITH_AVFFT AND NOT FFMPEG_LIBAVCODEC_FFT_FOUND) | ||
|
||
if(WITH_FFTW3 AND NOT FFTW3_FOUND) | ||
message(FATAL_ERROR "FFTW3 not found") | ||
endif(WITH_FFTW3 AND NOT FFTW3_FOUND) | ||
|
||
if(NOT WITH_AVFFT AND NOT WITH_FFTW3) | ||
if(FFMPEG_LIBAVCODEC_FFT_FOUND) | ||
set(WITH_AVFFT ON) | ||
elseif(FFTW3_FOUND) | ||
set(WITH_FFTW3 ON) | ||
else(FFTW3_FOUND) | ||
message(FATAL_ERROR "Neither FFmpeg with avfft.h nor FFTW3 found") | ||
endif(FFMPEG_LIBAVCODEC_FFT_FOUND) | ||
endif(NOT WITH_AVFFT AND NOT WITH_FFTW3) | ||
|
||
if(WITH_AVFFT) | ||
message(STATUS "Using FFmpeg for FFT calculations") | ||
endif(WITH_AVFFT) | ||
|
||
if(WITH_FFTW3) | ||
message(STATUS "Using FFTW3 for FFT calculations") | ||
endif(WITH_FFTW3) | ||
|
||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) | ||
|
||
add_subdirectory(src) | ||
|
||
if(BUILD_TOOLS_EXTRA) | ||
find_package(PNG REQUIRED) | ||
endif(BUILD_TOOLS_EXTRA) | ||
|
||
if(BUILD_TOOLS OR BUILD_TOOLS_EXTRA) | ||
#find_package(Boost COMPONENTS system filesystem REQUIRED) | ||
find_package(Boost REQUIRED) | ||
find_package(FFmpeg REQUIRED) | ||
find_package(Taglib REQUIRED) | ||
add_subdirectory(tools) | ||
endif(BUILD_TOOLS OR BUILD_TOOLS_EXTRA) | ||
|
||
if(BUILD_TESTS) | ||
find_package(GTest REQUIRED) | ||
add_subdirectory(tests) | ||
endif(BUILD_TESTS) | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
Chromaprint | ||
=========== | ||
|
||
Dependencies | ||
------------ | ||
|
||
The library itself only depends on a FFT library, which at the moment can | ||
be either FFmpeg [1] (at least r22291, 0.6 is fine) or FFTW3 [2]. See the | ||
next section for details. | ||
|
||
The tools included in the package require FFmpeg (can be older), TagLib [3] | ||
and Boost Filesystem [4]. | ||
|
||
In order to build the test suite, you will need the Google Test library [5]. | ||
|
||
[1] http://www.ffmpeg.org/ | ||
[2] http://www.fftw.org/ | ||
[3] http://developer.kde.org/~wheeler/taglib.html | ||
[4] http://www.boost.org/ | ||
[5] http://code.google.com/p/googletest/ | ||
|
||
FFT Library | ||
----------- | ||
|
||
Chromaprint can use two FFT libraries, FFmpeg or FFTW3. FFmpeg is preffered, | ||
as it's a little faster for our purposes and it's LGPL-licensed, so it | ||
doesn't impact the license of Chromaprint. The FFT interface was added only | ||
recently though, so it might not be available in Linux distributions yet. | ||
FFTW3 can be used in this case, but this library is released under the GPL | ||
license, which makes also the resulting Chromaprint binary GPL licensed. | ||
|
||
If you run simple `cmake .`, it will try to find both FFmpeg and FFTW3 and | ||
select the first one it finds. If you have new FFmpeg installed in a separate | ||
location, you can let CMake know using the `FFMPEG_ROOT` option: | ||
|
||
$ cmake -DFFMPEG_ROOT=/path/to/local/ffmpeg/install . | ||
|
||
If you have new FFmpeg installed, but for some reason prefer to use FFTW3, you | ||
can use the `WITH_FFTW3` option: | ||
|
||
$ cmake -DWITH_FFTW3=ON . | ||
|
||
There is also a `WITH_AVFFT` option, but the script will select the FFmpeg FFT | ||
automatically if it's available, so it shouldn't be necessary to use it. | ||
|
||
Unit Tests | ||
---------- | ||
|
||
The test suite can be built and run using the following commands: | ||
|
||
$ cmake -DBUILD_TESTS=ON . | ||
$ make check | ||
|
||
Standing on the Shoulder of Giants | ||
---------------------------------- | ||
|
||
I've learned a lot while working on this project, which would not be possible | ||
without having information from past research. I've read many papers, but the | ||
concrete ideas implemented in this library are based on the following papers: | ||
|
||
* Yan Ke, Derek Hoiem, Rahul Sukthankar. Computer Vision for Music | ||
Identification, Proceedings of Computer Vision and Pattern Recognition, | ||
2005. http://www.cs.cmu.edu/~yke/musicretrieval/ | ||
|
||
* Frank Kurth, Meinard Müller. Efficient Index-Based Audio Matching, 2008. | ||
http://dx.doi.org/10.1109/TASL.2007.911552 | ||
|
||
* Dalwon Jang, Chang D. Yoo, Sunil Lee, Sungwoong Kim, Ton Kalker. | ||
Pairwise Boosted Audio Fingerprint, 2009. | ||
http://dx.doi.org/10.1109/TIFS.2009.2034452 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
# | ||
# Try to find FFTW3 library | ||
# (see www.fftw.org) | ||
# Once run this will define: | ||
# | ||
# FFTW3_FOUND | ||
# FFTW3_INCLUDE_DIR | ||
# FFTW3_LIBRARIES | ||
# FFTW3_LINK_DIRECTORIES | ||
# | ||
# You may set one of these options before including this file: | ||
# FFTW3_USE_SSE2 | ||
# | ||
# TODO: _F_ versions. | ||
# | ||
# Jan Woetzel 05/2004 | ||
# www.mip.informatik.uni-kiel.de | ||
# -------------------------------- | ||
|
||
FIND_PATH(FFTW3_INCLUDE_DIR fftw3.h | ||
${FFTW3_DIR}/include | ||
${FFTW3_HOME}/include | ||
${FFTW3_DIR} | ||
${FFTW3_HOME} | ||
$ENV{FFTW3_DIR}/include | ||
$ENV{FFTW3_HOME}/include | ||
$ENV{FFTW3_DIR} | ||
$ENV{FFTW3_HOME} | ||
/usr/include | ||
/usr/local/include | ||
$ENV{SOURCE_DIR}/fftw3 | ||
$ENV{SOURCE_DIR}/fftw3/include | ||
$ENV{SOURCE_DIR}/fftw | ||
$ENV{SOURCE_DIR}/fftw/include | ||
) | ||
#MESSAGE("DBG FFTW3_INCLUDE_DIR=${FFTW3_INCLUDE_DIR}") | ||
|
||
|
||
SET(FFTW3_POSSIBLE_LIBRARY_PATH | ||
${FFTW3_DIR}/lib | ||
${FFTW3_HOME}/lib | ||
${FFTW3_DIR} | ||
${FFTW3_HOME} | ||
$ENV{FFTW3_DIR}/lib | ||
$ENV{FFTW3_HOME}/lib | ||
$ENV{FFTW3_DIR} | ||
$ENV{FFTW3_HOME} | ||
/usr/lib | ||
/usr/local/lib | ||
$ENV{SOURCE_DIR}/fftw3 | ||
$ENV{SOURCE_DIR}/fftw3/lib | ||
$ENV{SOURCE_DIR}/fftw | ||
$ENV{SOURCE_DIR}/fftw/lib | ||
) | ||
|
||
|
||
# the lib prefix is containe din filename onf W32, unfortuantely. JW | ||
# teh "general" lib: | ||
FIND_LIBRARY(FFTW3_FFTW_LIBRARY | ||
NAMES fftw3 libfftw libfftw3 libfftw3-3 | ||
PATHS | ||
${FFTW3_POSSIBLE_LIBRARY_PATH} | ||
) | ||
#MESSAGE("DBG FFTW3_FFTW_LIBRARY=${FFTW3_FFTW_LIBRARY}") | ||
|
||
FIND_LIBRARY(FFTW3_FFTWF_LIBRARY | ||
NAMES fftwf3 fftwf libfftwf libfftwf3 libfftw3f-3 | ||
PATHS | ||
${FFTW3_POSSIBLE_LIBRARY_PATH} | ||
) | ||
#MESSAGE("DBG FFTW3_FFTWF_LIBRARY=${FFTW3_FFTWF_LIBRARY}") | ||
|
||
FIND_LIBRARY(FFTW3_FFTWL_LIBRARY | ||
NAMES fftwl3 fftwl libfftwl libfftwl3 libfftw3l-3 | ||
PATHS | ||
${FFTW3_POSSIBLE_LIBRARY_PATH} | ||
) | ||
#MESSAGE("DBG FFTW3_FFTWF_LIBRARY=${FFTW3_FFTWL_LIBRARY}") | ||
|
||
|
||
FIND_LIBRARY(FFTW3_FFTW_SSE2_LIBRARY | ||
NAMES fftw_sse2 fftw3_sse2 libfftw_sse2 libfftw3_sse2 | ||
PATHS | ||
${FFTW3_POSSIBLE_LIBRARY_PATH} | ||
) | ||
#MESSAGE("DBG FFTW3_FFTW_SSE2_LIBRARY=${FFTW3_FFTW_SSE2_LIBRARY}") | ||
|
||
FIND_LIBRARY(FFTW3_FFTWF_SSE_LIBRARY | ||
NAMES fftwf_sse fftwf3_sse libfftwf_sse libfftwf3_sse | ||
PATHS | ||
${FFTW3_POSSIBLE_LIBRARY_PATH} | ||
) | ||
#MESSAGE("DBG FFTW3_FFTWF_SSE_LIBRARY=${FFTW3_FFTWF_SSE_LIBRARY}") | ||
|
||
|
||
# -------------------------------- | ||
# select one of the above | ||
# default: | ||
IF (FFTW3_FFTW_LIBRARY) | ||
SET(FFTW3_LIBRARIES ${FFTW3_FFTW_LIBRARY}) | ||
ENDIF (FFTW3_FFTW_LIBRARY) | ||
# specialized: | ||
IF (FFTW3_USE_SSE2 AND FFTW3_FFTW_SSE2_LIBRARY) | ||
SET(FFTW3_LIBRARIES ${FFTW3_FFTW_SSE2_LIBRARY}) | ||
ENDIF (FFTW3_USE_SSE2 AND FFTW3_FFTW_SSE2_LIBRARY) | ||
|
||
# -------------------------------- | ||
|
||
IF(FFTW3_LIBRARIES) | ||
IF (FFTW3_INCLUDE_DIR) | ||
|
||
# OK, found all we need | ||
SET(FFTW3_FOUND TRUE) | ||
GET_FILENAME_COMPONENT(FFTW3_LINK_DIRECTORIES ${FFTW3_LIBRARIES} PATH) | ||
|
||
ELSE (FFTW3_INCLUDE_DIR) | ||
MESSAGE("FFTW3 include dir not found. Set FFTW3_DIR to find it.") | ||
ENDIF(FFTW3_INCLUDE_DIR) | ||
ELSE(FFTW3_LIBRARIES) | ||
MESSAGE("FFTW3 lib not found. Set FFTW3_DIR to find it.") | ||
ENDIF(FFTW3_LIBRARIES) | ||
|
||
|
||
MARK_AS_ADVANCED( | ||
FFTW3_INCLUDE_DIR | ||
FFTW3_LIBRARIES | ||
FFTW3_FFTW_LIBRARY | ||
FFTW3_FFTW_SSE2_LIBRARY | ||
FFTW3_FFTWF_LIBRARY | ||
FFTW3_FFTWF_SSE_LIBRARY | ||
FFTW3_FFTWL_LIBRARY | ||
FFTW3_LINK_DIRECTORIES | ||
) |
Oops, something went wrong.