From a18a621c0a3d501c249a077af7b109e26ac160fc Mon Sep 17 00:00:00 2001 From: John Maguire Date: Mon, 9 Feb 2015 14:15:34 +0100 Subject: [PATCH] Remove our copy of chromaprint. --- 3rdparty/chromaprint/CMakeLists.txt | 109 ---- 3rdparty/chromaprint/COPYING.txt | 502 ------------------ .../cmake/modules/FindFFmpeg.cmake | 128 ----- .../chromaprint/cmake/modules/FindGTest.cmake | 175 ------ .../cmake/modules/FindTaglib.cmake | 135 ----- 3rdparty/chromaprint/config.h.in | 7 - 3rdparty/chromaprint/src/CMakeLists.txt | 51 -- 3rdparty/chromaprint/src/audio_consumer.h | 38 -- 3rdparty/chromaprint/src/audio_processor.cpp | 191 ------- 3rdparty/chromaprint/src/audio_processor.h | 87 --- 3rdparty/chromaprint/src/avresample/avcodec.h | 101 ---- 3rdparty/chromaprint/src/avresample/dsputil.h | 1 - .../chromaprint/src/avresample/resample2.c | 320 ----------- 3rdparty/chromaprint/src/base64.cpp | 92 ---- 3rdparty/chromaprint/src/base64.h | 35 -- 3rdparty/chromaprint/src/bit_string_reader.h | 69 --- 3rdparty/chromaprint/src/bit_string_writer.h | 77 --- 3rdparty/chromaprint/src/chroma.cpp | 95 ---- 3rdparty/chromaprint/src/chroma.h | 68 --- 3rdparty/chromaprint/src/chroma_filter.cpp | 69 --- 3rdparty/chromaprint/src/chroma_filter.h | 54 -- 3rdparty/chromaprint/src/chroma_normalizer.h | 55 -- 3rdparty/chromaprint/src/chroma_resampler.cpp | 62 --- 3rdparty/chromaprint/src/chroma_resampler.h | 52 -- 3rdparty/chromaprint/src/chromaprint.cpp | 150 ------ 3rdparty/chromaprint/src/chromaprint.h | 222 -------- 3rdparty/chromaprint/src/classifier.h | 61 --- 3rdparty/chromaprint/src/combined_buffer.h | 176 ------ 3rdparty/chromaprint/src/debug.h | 42 -- 3rdparty/chromaprint/src/decoder.h | 15 - 3rdparty/chromaprint/src/ext/audio_dumper.h | 30 -- 3rdparty/chromaprint/src/ext/ffmpeg_decoder.h | 230 -------- 3rdparty/chromaprint/src/ext/image_utils.cpp | 27 - 3rdparty/chromaprint/src/ext/image_utils.h | 108 ---- 3rdparty/chromaprint/src/ext/sox_decoder.h | 101 ---- .../chromaprint/src/feature_vector_consumer.h | 39 -- 3rdparty/chromaprint/src/fft.cpp | 77 --- 3rdparty/chromaprint/src/fft.h | 62 --- 3rdparty/chromaprint/src/fft_frame.h | 69 --- 3rdparty/chromaprint/src/fft_frame_consumer.h | 38 -- 3rdparty/chromaprint/src/fft_lib.h | 40 -- 3rdparty/chromaprint/src/fft_lib_avfft.cpp | 64 --- 3rdparty/chromaprint/src/fft_lib_avfft.h | 51 -- 3rdparty/chromaprint/src/fft_lib_fftw3.cpp | 58 -- 3rdparty/chromaprint/src/fft_lib_fftw3.h | 51 -- 3rdparty/chromaprint/src/fft_lib_vdsp.cpp | 61 --- 3rdparty/chromaprint/src/fft_lib_vdsp.h | 52 -- 3rdparty/chromaprint/src/filter.cpp | 47 -- 3rdparty/chromaprint/src/filter.h | 67 --- 3rdparty/chromaprint/src/filter_utils.h | 136 ----- .../src/fingerprint_calculator.cpp | 67 --- .../chromaprint/src/fingerprint_calculator.h | 51 -- .../src/fingerprint_compressor.cpp | 92 ---- .../chromaprint/src/fingerprint_compressor.h | 59 -- .../src/fingerprint_decompressor.cpp | 99 ---- .../src/fingerprint_decompressor.h | 56 -- 3rdparty/chromaprint/src/fingerprinter.cpp | 97 ---- 3rdparty/chromaprint/src/fingerprinter.h | 78 --- .../src/fingerprinter_configuration.cpp | 107 ---- .../src/fingerprinter_configuration.h | 126 ----- 3rdparty/chromaprint/src/image.h | 74 --- 3rdparty/chromaprint/src/image_builder.cpp | 43 -- 3rdparty/chromaprint/src/image_builder.h | 66 --- 3rdparty/chromaprint/src/integral_image.cpp | 49 -- 3rdparty/chromaprint/src/integral_image.h | 87 --- 3rdparty/chromaprint/src/lloyds.cpp | 111 ---- 3rdparty/chromaprint/src/lloyds.h | 15 - 3rdparty/chromaprint/src/quantizer.h | 76 --- 3rdparty/chromaprint/src/silence_remover.cpp | 65 --- 3rdparty/chromaprint/src/silence_remover.h | 59 -- 3rdparty/chromaprint/src/sox_audio_source.cpp | 71 --- 3rdparty/chromaprint/src/sox_audio_source.h | 29 - .../chromaprint/src/spectral_centroid.cpp | 91 ---- 3rdparty/chromaprint/src/spectral_centroid.h | 59 -- 3rdparty/chromaprint/src/spectrum.cpp | 88 --- 3rdparty/chromaprint/src/spectrum.h | 59 -- 3rdparty/chromaprint/src/utils.h | 155 ------ CMakeLists.txt | 11 - 78 files changed, 6687 deletions(-) delete mode 100644 3rdparty/chromaprint/CMakeLists.txt delete mode 100644 3rdparty/chromaprint/COPYING.txt delete mode 100644 3rdparty/chromaprint/cmake/modules/FindFFmpeg.cmake delete mode 100644 3rdparty/chromaprint/cmake/modules/FindGTest.cmake delete mode 100644 3rdparty/chromaprint/cmake/modules/FindTaglib.cmake delete mode 100644 3rdparty/chromaprint/config.h.in delete mode 100644 3rdparty/chromaprint/src/CMakeLists.txt delete mode 100644 3rdparty/chromaprint/src/audio_consumer.h delete mode 100644 3rdparty/chromaprint/src/audio_processor.cpp delete mode 100644 3rdparty/chromaprint/src/audio_processor.h delete mode 100644 3rdparty/chromaprint/src/avresample/avcodec.h delete mode 100644 3rdparty/chromaprint/src/avresample/dsputil.h delete mode 100644 3rdparty/chromaprint/src/avresample/resample2.c delete mode 100644 3rdparty/chromaprint/src/base64.cpp delete mode 100644 3rdparty/chromaprint/src/base64.h delete mode 100644 3rdparty/chromaprint/src/bit_string_reader.h delete mode 100644 3rdparty/chromaprint/src/bit_string_writer.h delete mode 100644 3rdparty/chromaprint/src/chroma.cpp delete mode 100644 3rdparty/chromaprint/src/chroma.h delete mode 100644 3rdparty/chromaprint/src/chroma_filter.cpp delete mode 100644 3rdparty/chromaprint/src/chroma_filter.h delete mode 100644 3rdparty/chromaprint/src/chroma_normalizer.h delete mode 100644 3rdparty/chromaprint/src/chroma_resampler.cpp delete mode 100644 3rdparty/chromaprint/src/chroma_resampler.h delete mode 100644 3rdparty/chromaprint/src/chromaprint.cpp delete mode 100644 3rdparty/chromaprint/src/chromaprint.h delete mode 100644 3rdparty/chromaprint/src/classifier.h delete mode 100644 3rdparty/chromaprint/src/combined_buffer.h delete mode 100644 3rdparty/chromaprint/src/debug.h delete mode 100644 3rdparty/chromaprint/src/decoder.h delete mode 100644 3rdparty/chromaprint/src/ext/audio_dumper.h delete mode 100644 3rdparty/chromaprint/src/ext/ffmpeg_decoder.h delete mode 100644 3rdparty/chromaprint/src/ext/image_utils.cpp delete mode 100644 3rdparty/chromaprint/src/ext/image_utils.h delete mode 100644 3rdparty/chromaprint/src/ext/sox_decoder.h delete mode 100644 3rdparty/chromaprint/src/feature_vector_consumer.h delete mode 100644 3rdparty/chromaprint/src/fft.cpp delete mode 100644 3rdparty/chromaprint/src/fft.h delete mode 100644 3rdparty/chromaprint/src/fft_frame.h delete mode 100644 3rdparty/chromaprint/src/fft_frame_consumer.h delete mode 100644 3rdparty/chromaprint/src/fft_lib.h delete mode 100644 3rdparty/chromaprint/src/fft_lib_avfft.cpp delete mode 100644 3rdparty/chromaprint/src/fft_lib_avfft.h delete mode 100644 3rdparty/chromaprint/src/fft_lib_fftw3.cpp delete mode 100644 3rdparty/chromaprint/src/fft_lib_fftw3.h delete mode 100644 3rdparty/chromaprint/src/fft_lib_vdsp.cpp delete mode 100644 3rdparty/chromaprint/src/fft_lib_vdsp.h delete mode 100644 3rdparty/chromaprint/src/filter.cpp delete mode 100644 3rdparty/chromaprint/src/filter.h delete mode 100644 3rdparty/chromaprint/src/filter_utils.h delete mode 100644 3rdparty/chromaprint/src/fingerprint_calculator.cpp delete mode 100644 3rdparty/chromaprint/src/fingerprint_calculator.h delete mode 100644 3rdparty/chromaprint/src/fingerprint_compressor.cpp delete mode 100644 3rdparty/chromaprint/src/fingerprint_compressor.h delete mode 100644 3rdparty/chromaprint/src/fingerprint_decompressor.cpp delete mode 100644 3rdparty/chromaprint/src/fingerprint_decompressor.h delete mode 100644 3rdparty/chromaprint/src/fingerprinter.cpp delete mode 100644 3rdparty/chromaprint/src/fingerprinter.h delete mode 100644 3rdparty/chromaprint/src/fingerprinter_configuration.cpp delete mode 100644 3rdparty/chromaprint/src/fingerprinter_configuration.h delete mode 100644 3rdparty/chromaprint/src/image.h delete mode 100644 3rdparty/chromaprint/src/image_builder.cpp delete mode 100644 3rdparty/chromaprint/src/image_builder.h delete mode 100644 3rdparty/chromaprint/src/integral_image.cpp delete mode 100644 3rdparty/chromaprint/src/integral_image.h delete mode 100644 3rdparty/chromaprint/src/lloyds.cpp delete mode 100644 3rdparty/chromaprint/src/lloyds.h delete mode 100644 3rdparty/chromaprint/src/quantizer.h delete mode 100644 3rdparty/chromaprint/src/silence_remover.cpp delete mode 100644 3rdparty/chromaprint/src/silence_remover.h delete mode 100644 3rdparty/chromaprint/src/sox_audio_source.cpp delete mode 100644 3rdparty/chromaprint/src/sox_audio_source.h delete mode 100644 3rdparty/chromaprint/src/spectral_centroid.cpp delete mode 100644 3rdparty/chromaprint/src/spectral_centroid.h delete mode 100644 3rdparty/chromaprint/src/spectrum.cpp delete mode 100644 3rdparty/chromaprint/src/spectrum.h delete mode 100644 3rdparty/chromaprint/src/utils.h diff --git a/3rdparty/chromaprint/CMakeLists.txt b/3rdparty/chromaprint/CMakeLists.txt deleted file mode 100644 index 09247ac0b..000000000 --- a/3rdparty/chromaprint/CMakeLists.txt +++ /dev/null @@ -1,109 +0,0 @@ -cmake_minimum_required(VERSION 2.6) - -project(chromaprint) -set(PROJECT_VERSION 0.6.0) - -# 1. If the library source code has changed at all since the last update, then increment revision. -# 2. If any interfaces have been added, removed, or changed since the last update, increment current, and set revision to 0. -# 3. If any interfaces have been added since the last public release, then increment age. -# 4. If any interfaces have been removed since the last public release, then set age to 0. -set(chromaprint_SOVERSION_CURRENT 1) -set(chromaprint_SOVERSION_REVISION 4) -set(chromaprint_SOVERSION_AGE 1) - -math(EXPR chromaprint_SOVERSION_MAJOR "${chromaprint_SOVERSION_CURRENT} - ${chromaprint_SOVERSION_AGE}") -math(EXPR chromaprint_SOVERSION_MINOR "${chromaprint_SOVERSION_AGE}") -math(EXPR chromaprint_SOVERSION_PATCH "${chromaprint_SOVERSION_REVISION}") - -set(chromaprint_VERSION ${chromaprint_SOVERSION_MAJOR}.${chromaprint_SOVERSION_MINOR}.${chromaprint_SOVERSION_PATCH}) -set(chromaprint_SOVERSION ${chromaprint_SOVERSION_MAJOR}) - -include(CheckFunctionExists) -set(CMAKE_REQUIRED_LIBRARIES -lm) -check_function_exists(lrintf HAVE_LRINTF) -check_function_exists(round HAVE_ROUND) - -add_definitions( - -DHAVE_CONFIG_H - -D_SCL_SECURE_NO_WARNINGS - -D_USE_MATH_DEFINES - -D__STDC_LIMIT_MACROS - -D__STDC_CONSTANT_MACROS -) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - -set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)") -set(EXEC_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE PATH "Installation prefix for executables and object code libraries" FORCE) -set(BIN_INSTALL_DIR ${EXEC_INSTALL_PREFIX}/bin CACHE PATH "Installation prefix for user executables" FORCE) -set(LIB_INSTALL_DIR ${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX} CACHE PATH "Installation prefix for object code libraries" FORCE) -set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include CACHE PATH "Installation prefix for C header files" FORCE) - -if(CMAKE_COMPILER_IS_GNUCXX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") -endif() - -option(WITH_AVFFT "Use FFmpeg for FFT calculations" OFF) -option(WITH_FFTW3 "Use FFTW3 for FFT calculations" OFF) -option(WITH_VDSP "Use vDSP for FFT calculations" OFF) - -set(TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tests/) - -set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) -find_package(FFmpeg) -if(APPLE) - find_library(ACCELERATE_LIBRARIES Accelerate) -endif() - -set(FFT_OPTION_COUNT 0) - -if(WITH_AVFFT) - math(EXPR FFT_OPTION_COUNT "${FFT_OPTION_COUNT} + 1") -endif() -if(WITH_FFTW3) - math(EXPR FFT_OPTION_COUNT "${FFT_OPTION_COUNT} + 1") -endif() -if(WITH_VDSP) - math(EXPR FFT_OPTION_COUNT "${FFT_OPTION_COUNT} + 1") -endif() -if(FFT_OPTION_COUNT GREATER "1") - message(FATAL_ERROR "Only one of WITH_AVFFT, WITH_FFTW3 AND WITH_VDSP can be selected") -endif() - -if(WITH_AVFFT AND NOT FFMPEG_LIBAVCODEC_FFT_FOUND) - message(FATAL_ERROR "FFmpeg with avfft.h not found") -endif() - -if(WITH_FFTW3 AND NOT FFTW3_FOUND) - message(FATAL_ERROR "FFTW3 not found") -endif() - -if(APPLE AND WITH_VDSP AND NOT ACCELERATE_LIBRARIES) - message(FATAL_ERROR "vDSP (Accelerate) not found") -endif() - -if(NOT WITH_AVFFT AND NOT WITH_FFTW3) - if(APPLE AND ACCELERATE_LIBRARIES) - set(WITH_VDSP ON) - elseif(FFMPEG_LIBAVCODEC_FFT_FOUND) - set(WITH_AVFFT ON) - elseif(FFTW3_FOUND) - set(WITH_FFTW3 ON) - else() - message(FATAL_ERROR "Neither FFmpeg with avfft.h nor FFTW3 found") - endif() -endif() - -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}/chromaprint_config.h) - -add_subdirectory(src) - diff --git a/3rdparty/chromaprint/COPYING.txt b/3rdparty/chromaprint/COPYING.txt deleted file mode 100644 index 4362b4915..000000000 --- a/3rdparty/chromaprint/COPYING.txt +++ /dev/null @@ -1,502 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! diff --git a/3rdparty/chromaprint/cmake/modules/FindFFmpeg.cmake b/3rdparty/chromaprint/cmake/modules/FindFFmpeg.cmake deleted file mode 100644 index d29ec802b..000000000 --- a/3rdparty/chromaprint/cmake/modules/FindFFmpeg.cmake +++ /dev/null @@ -1,128 +0,0 @@ -# Locate ffmpeg -# This module defines -# FFMPEG_LIBRARIES -# FFMPEG_FOUND, if false, do not try to link to ffmpeg -# FFMPEG_INCLUDE_DIR, where to find the headers -# -# $FFMPEG_DIR is an environment variable that would -# correspond to the ./configure --prefix=$FFMPEG_DIR -# -# Created by Robert Osfield. -# Modified by Lukas Lalinsky. - - -#In ffmpeg code, old version use "#include " and newer use "#include " -#In OSG ffmpeg plugin, we use "#include " for compatibility with old version of ffmpeg - -#We have to search the path which contain the header.h (usefull for old version) -#and search the path which contain the libname/header.h (usefull for new version) - -#Then we need to include ${FFMPEG_libname_INCLUDE_DIRS} (in old version case, use by ffmpeg header and osg plugin code) -# (in new version case, use by ffmpeg header) -#and ${FFMPEG_libname_INCLUDE_DIRS/libname} (in new version case, use by osg plugin code) - -# Macro to find header and lib directories -# example: FFMPEG_FIND(AVFORMAT avformat avformat.h) -MACRO(FFMPEG_FIND varname shortname headername) - - FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS lib${shortname}/${headername} - PATHS - ${FFMPEG_ROOT}/include - $ENV{FFMPEG_DIR}/include - ~/Library/Frameworks - /Library/Frameworks - /usr/local/include - /usr/include/ - /sw/include # Fink - /opt/local/include # DarwinPorts - /opt/csw/include # Blastwave - /opt/include - /usr/freeware/include - NO_DEFAULT_PATH - PATH_SUFFIXES ffmpeg - DOC "Location of FFMPEG Headers" - ) - FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS lib${shortname}/${headername} - PATH_SUFFIXES ffmpeg - DOC "Location of FFMPEG Headers" - ) - - FIND_LIBRARY(FFMPEG_${varname}_LIBRARIES - NAMES ${shortname} - PATHS - ${FFMPEG_ROOT}/lib - $ENV{FFMPEG_DIR}/lib - ~/Library/Frameworks - /Library/Frameworks - /usr/local/lib - /usr/local/lib64 - /usr/lib - /usr/lib64 - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - /usr/freeware/lib64 - NO_DEFAULT_PATH - DOC "Location of FFMPEG Libraries" - ) - FIND_LIBRARY(FFMPEG_${varname}_LIBRARIES - NAMES ${shortname} - DOC "Location of FFMPEG Libraries" - ) - - IF (FFMPEG_${varname}_LIBRARIES AND FFMPEG_${varname}_INCLUDE_DIRS) - SET(FFMPEG_${varname}_FOUND 1) - ENDIF(FFMPEG_${varname}_LIBRARIES AND FFMPEG_${varname}_INCLUDE_DIRS) - -ENDMACRO(FFMPEG_FIND) - -SET(FFMPEG_ROOT "$ENV{FFMPEG_DIR}" CACHE PATH "Location of FFMPEG") - -# find stdint.h -FIND_PATH(FFMPEG_STDINT_INCLUDE_DIR stdint.h - PATHS - ${FFMPEG_ROOT}/include - $ENV{FFMPEG_DIR}/include - ~/Library/Frameworks - /Library/Frameworks - /usr/local/include - /usr/include - /sw/include # Fink - /opt/local/include # DarwinPorts - /opt/csw/include # Blastwave - /opt/include - /usr/freeware/include - PATH_SUFFIXES ffmpeg - DOC "Location of FFMPEG stdint.h Header" -) - -FFMPEG_FIND(LIBAVFORMAT avformat avformat.h) -FFMPEG_FIND(LIBAVDEVICE avdevice avdevice.h) -FFMPEG_FIND(LIBAVCODEC avcodec avcodec.h) -FFMPEG_FIND(LIBAVCODEC_FFT avcodec avfft.h) -FFMPEG_FIND(LIBAVUTIL avutil avutil.h) -FFMPEG_FIND(LIBSWSCALE swscale swscale.h) # not sure about the header to look for here. - -SET(FFMPEG_FOUND "NO") -# Note we don't check FFMPEG_LIBSWSCALE_FOUND here, it's optional. -IF (FFMPEG_LIBAVFORMAT_FOUND AND FFMPEG_LIBAVDEVICE_FOUND AND FFMPEG_LIBAVCODEC_FOUND AND FFMPEG_LIBAVUTIL_FOUND AND FFMPEG_STDINT_INCLUDE_DIR) - - SET(FFMPEG_FOUND "YES") - - SET(FFMPEG_INCLUDE_DIRS ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}) - - SET(FFMPEG_LIBRARY_DIRS ${FFMPEG_LIBAVFORMAT_LIBRARY_DIRS}) - - # Note we don't add FFMPEG_LIBSWSCALE_LIBRARIES here, it will be added if found later. - SET(FFMPEG_LIBRARIES - ${FFMPEG_LIBAVFORMAT_LIBRARIES} - ${FFMPEG_LIBAVDEVICE_LIBRARIES} - ${FFMPEG_LIBAVCODEC_LIBRARIES} - ${FFMPEG_LIBAVUTIL_LIBRARIES}) - -ELSE () - -# MESSAGE(STATUS "Could not find FFMPEG") - -ENDIF() diff --git a/3rdparty/chromaprint/cmake/modules/FindGTest.cmake b/3rdparty/chromaprint/cmake/modules/FindGTest.cmake deleted file mode 100644 index 367ffae66..000000000 --- a/3rdparty/chromaprint/cmake/modules/FindGTest.cmake +++ /dev/null @@ -1,175 +0,0 @@ -# Locate the Google C++ Testing Framework. -# -# Defines the following variables: -# -# GTEST_FOUND - Found the Google Testing framework -# GTEST_INCLUDE_DIRS - Include directories -# -# Also defines the library variables below as normal -# variables. These contain debug/optimized keywords when -# a debugging library is found. -# -# GTEST_BOTH_LIBRARIES - Both libgtest & libgtest-main -# GTEST_LIBRARIES - libgtest -# GTEST_MAIN_LIBRARIES - libgtest-main -# -# Accepts the following variables as input: -# -# GTEST_ROOT - (as CMake or env. variable) -# The root directory of the gtest install prefix -# -# GTEST_MSVC_SEARCH - If on MSVC, enables searching the build tree of -# GTest if set to MD or MT (defaults: MD) -# -#----------------------- -# Example Usage: -# -# enable_testing(true) -# find_package(GTest REQUIRED) -# include_directories(${GTEST_INCLUDE_DIRS}) -# -# add_executable(foo foo.cc) -# target_link_libraries(foo ${GTEST_BOTH_LIBRARIES}) -# -# add_test(AllTestsInFoo foo) -# -#----------------------- -# -# If you would like each Google test to show up in CTest as -# a test you may use the following macro. NOTE: It WILL slow -# down your tests, so be warned. -# -# GTEST_ADD_TESTS(executable extra_args ARGN) -# executable = The path to the test executable -# extra_args = Pass a list of extra arguments to be passed to -# executable enclosed in quotes (or "" for none) -# ARGN = A list of source files to search for tests & test -# fixtures. -# -# Example: -# set(FooTestArgs --foo 1 --bar 2) -# add_executable(FooTest FooUnitTest.cc) -# GTEST_ADD_TESTS(FooTest "${FooTestArgs}" FooUnitTest.cc) - -#============================================================================= -# Copyright 2009 Kitware, Inc. -# Copyright 2009 Philip Lowman -# Copyright 2009 Daniel Blezek -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# * 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. -# -# * Neither the names of Kitware, Inc., the Insight Software Consortium, -# nor the names of their contributors may be used to endorse or promote -# products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "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 COPYRIGHT -# HOLDER OR CONTRIBUTORS 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. -# -#============================================================================= -# -# Thanks to Daniel Blezek for the GTEST_ADD_TESTS code - -function(GTEST_ADD_TESTS executable extra_args) - if(NOT ARGN) - message(FATAL_ERROR "Missing ARGN: Read the documentation for GTEST_ADD_TESTS") - endif() - foreach(source ${ARGN}) - file(READ "${source}" contents) - string(REGEX MATCHALL "TEST_?F?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents}) - foreach(hit ${found_tests}) - string(REGEX REPLACE ".*\\(([A-Za-z_0-9]+)[, ]*([A-Za-z_0-9]+)\\).*" "\\1.\\2" test_name ${hit}) - add_test(${test_name} ${executable} --gtest_filter=${test_name} ${extra_args}) - endforeach() - endforeach() -endfunction() - -function(_gtest_append_debugs _endvar _library) - if(${_library} AND ${_library}_DEBUG) - set(_output optimized ${${_library}} debug ${${_library}_DEBUG}) - else() - set(_output ${${_library}}) - endif() - set(${_endvar} ${_output} PARENT_SCOPE) -endfunction() - -function(_gtest_find_library _name) - find_library(${_name} - NAMES ${ARGN} - HINTS - $ENV{GTEST_ROOT} - ${GTEST_ROOT} - PATH_SUFFIXES ${_gtest_libpath_suffixes} - ) - mark_as_advanced(${_name}) -endfunction() - -# - -if(NOT DEFINED GTEST_MSVC_SEARCH) - set(GTEST_MSVC_SEARCH MD) -endif() - -set(_gtest_libpath_suffixes lib) -if(MSVC) - if(GTEST_MSVC_SEARCH STREQUAL "MD") - list(APPEND _gtest_libpath_suffixes - msvc/gtest-md/Debug - msvc/gtest-md/Release) - elseif(GTEST_MSVC_SEARCH STREQUAL "MT") - list(APPEND _gtest_libpath_suffixes - msvc/gtest/Debug - msvc/gtest/Release) - endif() -endif() - - -find_path(GTEST_INCLUDE_DIR gtest/gtest.h - HINTS - $ENV{GTEST_ROOT}/include - ${GTEST_ROOT}/include -) -mark_as_advanced(GTEST_INCLUDE_DIR) - -if(MSVC AND GTEST_MSVC_SEARCH STREQUAL "MD") - # The provided /MD project files for Google Test add -md suffixes to the - # library names. - _gtest_find_library(GTEST_LIBRARY gtest-md gtest) - _gtest_find_library(GTEST_LIBRARY_DEBUG gtest-mdd gtestd) - _gtest_find_library(GTEST_MAIN_LIBRARY gtest_main-md gtest_main) - _gtest_find_library(GTEST_MAIN_LIBRARY_DEBUG gtest_main-mdd gtest_maind) -else() - _gtest_find_library(GTEST_LIBRARY gtest) - _gtest_find_library(GTEST_LIBRARY_DEBUG gtestd) - _gtest_find_library(GTEST_MAIN_LIBRARY gtest_main) - _gtest_find_library(GTEST_MAIN_LIBRARY_DEBUG gtest_maind) -endif() - -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTest DEFAULT_MSG GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY) - -if(GTEST_FOUND) - set(GTEST_INCLUDE_DIRS ${GTEST_INCLUDE_DIR}) - _gtest_append_debugs(GTEST_LIBRARIES GTEST_LIBRARY) - _gtest_append_debugs(GTEST_MAIN_LIBRARIES GTEST_MAIN_LIBRARY) - set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES}) -endif() - diff --git a/3rdparty/chromaprint/cmake/modules/FindTaglib.cmake b/3rdparty/chromaprint/cmake/modules/FindTaglib.cmake deleted file mode 100644 index 76b83ac55..000000000 --- a/3rdparty/chromaprint/cmake/modules/FindTaglib.cmake +++ /dev/null @@ -1,135 +0,0 @@ -# - Try to find the Taglib library -# Once done this will define -# -# TAGLIB_FOUND - system has the taglib library -# TAGLIB_CFLAGS - the taglib cflags -# TAGLIB_LIBRARIES - The libraries needed to use taglib - -# Copyright (c) 2006, Laurent Montel, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -if(NOT TAGLIB_MIN_VERSION) - set(TAGLIB_MIN_VERSION "1.6") -endif(NOT TAGLIB_MIN_VERSION) - -if(NOT WIN32) - find_program(TAGLIBCONFIG_EXECUTABLE NAMES taglib-config PATHS - ${BIN_INSTALL_DIR} - ) -endif(NOT WIN32) - -#reset vars -set(TAGLIB_LIBRARIES) -set(TAGLIB_CFLAGS) - -# if taglib-config has been found -if(TAGLIBCONFIG_EXECUTABLE) - - exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --version RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_VERSION) - - if(TAGLIB_VERSION STRLESS "${TAGLIB_MIN_VERSION}") - message(STATUS "TagLib version too old: version searched :${TAGLIB_MIN_VERSION}, found ${TAGLIB_VERSION}") - set(TAGLIB_FOUND FALSE) - else(TAGLIB_VERSION STRLESS "${TAGLIB_MIN_VERSION}") - - exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_LIBRARIES) - - exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_CFLAGS) - - if(TAGLIB_LIBRARIES AND TAGLIB_CFLAGS) - set(TAGLIB_FOUND TRUE) - endif(TAGLIB_LIBRARIES AND TAGLIB_CFLAGS) - string(REGEX REPLACE " *-I" ";" TAGLIB_INCLUDES "${TAGLIB_CFLAGS}") - endif(TAGLIB_VERSION STRLESS "${TAGLIB_MIN_VERSION}") - mark_as_advanced(TAGLIB_CFLAGS TAGLIB_LIBRARIES TAGLIB_INCLUDES) - -else(TAGLIBCONFIG_EXECUTABLE) - - find_path(TAGLIB_INCLUDES - NAMES - tag.h - PATH_SUFFIXES taglib - PATHS - ${KDE4_INCLUDE_DIR} - ${INCLUDE_INSTALL_DIR} - ) - - IF(NOT WIN32) - # on non-win32 we don't need to take care about WIN32_DEBUG_POSTFIX - - FIND_LIBRARY(TAGLIB_LIBRARIES tag PATHS ${KDE4_LIB_DIR} ${LIB_INSTALL_DIR}) - - ELSE(NOT WIN32) - - # 1. get all possible libnames - SET(args PATHS ${KDE4_LIB_DIR} ${LIB_INSTALL_DIR}) - SET(newargs "") - SET(libnames_release "") - SET(libnames_debug "") - - LIST(LENGTH args listCount) - - # just one name - LIST(APPEND libnames_release "tag") - LIST(APPEND libnames_debug "tagd") - - SET(newargs ${args}) - - # search the release lib - FIND_LIBRARY(TAGLIB_LIBRARIES_RELEASE - NAMES ${libnames_release} - ${newargs} - ) - - # search the debug lib - FIND_LIBRARY(TAGLIB_LIBRARIES_DEBUG - NAMES ${libnames_debug} - ${newargs} - ) - - IF(TAGLIB_LIBRARIES_RELEASE AND TAGLIB_LIBRARIES_DEBUG) - - # both libs found - SET(TAGLIB_LIBRARIES optimized ${TAGLIB_LIBRARIES_RELEASE} - debug ${TAGLIB_LIBRARIES_DEBUG}) - - ELSE(TAGLIB_LIBRARIES_RELEASE AND TAGLIB_LIBRARIES_DEBUG) - - IF(TAGLIB_LIBRARIES_RELEASE) - - # only release found - SET(TAGLIB_LIBRARIES ${TAGLIB_LIBRARIES_RELEASE}) - - ELSE(TAGLIB_LIBRARIES_RELEASE) - - # only debug (or nothing) found - SET(TAGLIB_LIBRARIES ${TAGLIB_LIBRARIES_DEBUG}) - - ENDIF(TAGLIB_LIBRARIES_RELEASE) - - ENDIF(TAGLIB_LIBRARIES_RELEASE AND TAGLIB_LIBRARIES_DEBUG) - - MARK_AS_ADVANCED(TAGLIB_LIBRARIES_RELEASE) - MARK_AS_ADVANCED(TAGLIB_LIBRARIES_DEBUG) - - ENDIF(NOT WIN32) - - INCLUDE(FindPackageMessage) - INCLUDE(FindPackageHandleStandardArgs) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(Taglib DEFAULT_MSG TAGLIB_INCLUDES TAGLIB_LIBRARIES) - -endif(TAGLIBCONFIG_EXECUTABLE) - - -if(TAGLIB_FOUND) - if(NOT Taglib_FIND_QUIETLY AND TAGLIBCONFIG_EXECUTABLE) - message(STATUS "Taglib found: ${TAGLIB_LIBRARIES}") - endif(NOT Taglib_FIND_QUIETLY AND TAGLIBCONFIG_EXECUTABLE) -else(TAGLIB_FOUND) - if(Taglib_FIND_REQUIRED) - message(FATAL_ERROR "Could not find Taglib") - endif(Taglib_FIND_REQUIRED) -endif(TAGLIB_FOUND) - diff --git a/3rdparty/chromaprint/config.h.in b/3rdparty/chromaprint/config.h.in deleted file mode 100644 index f87db71ad..000000000 --- a/3rdparty/chromaprint/config.h.in +++ /dev/null @@ -1,7 +0,0 @@ -#cmakedefine HAVE_ROUND 1 -#cmakedefine HAVE_LRINTF 1 -#cmakedefine WITH_AVFFT 1 -#cmakedefine WITH_FFTW3 1 -#cmakedefine WITH_VDSP 1 -#cmakedefine TESTS_DIR "@TESTS_DIR@" - diff --git a/3rdparty/chromaprint/src/CMakeLists.txt b/3rdparty/chromaprint/src/CMakeLists.txt deleted file mode 100644 index 442a0c2fa..000000000 --- a/3rdparty/chromaprint/src/CMakeLists.txt +++ /dev/null @@ -1,51 +0,0 @@ -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - -set(chromaprint_SRCS - chromaprint.cpp - audio_processor.cpp - chroma.cpp - chroma_resampler.cpp - chroma_filter.cpp - integral_image.cpp - spectrum.cpp - spectral_centroid.cpp - filter.cpp - fft.cpp - fingerprinter.cpp - image_builder.cpp - lloyds.cpp - silence_remover.cpp - fingerprint_calculator.cpp - fingerprint_compressor.cpp - fingerprint_decompressor.cpp - fingerprinter_configuration.cpp - base64.cpp - avresample/resample2.c -) - -if(WITH_AVFFT) - set(chromaprint_SRCS fft_lib_avfft.cpp ${chromaprint_SRCS}) - set(chromaprint_LINK_LIBS - ${FFMPEG_LIBAVCODEC_LIBRARIES} - ${FFMPEG_LIBAVUTIL_LIBRARIES} - ) - include_directories( - ${FFMPEG_LIBAVCODEC_INCLUDE_DIRS} - ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS} - ${FFMPEG_LIBAVUTIL_INCLUDE_DIRS} - ) -endif(WITH_AVFFT) - -if(WITH_FFTW3) - set(chromaprint_SRCS fft_lib_fftw3.cpp ${chromaprint_SRCS}) - set(chromaprint_LINK_LIBS ${FFTW3_LIBRARIES}) - include_directories(${FFTW3_INCLUDE_DIR}) -endif(WITH_FFTW3) - -if(WITH_VDSP) - set(chromaprint_SRCS fft_lib_vdsp.cpp ${chromaprint_SRCS}) - set(chromaprint_LINK_LIBS ${ACCELERATE_LIBRARIES}) -endif() - -add_library(chromaprint_p STATIC ${chromaprint_SRCS}) -target_link_libraries(chromaprint_p ${chromaprint_LINK_LIBS}) diff --git a/3rdparty/chromaprint/src/audio_consumer.h b/3rdparty/chromaprint/src/audio_consumer.h deleted file mode 100644 index b5070f640..000000000 --- a/3rdparty/chromaprint/src/audio_consumer.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_AUDIO_CONSUMER_H_ -#define CHROMAPRINT_AUDIO_CONSUMER_H_ - -namespace Chromaprint -{ - - class AudioConsumer - { - public: - virtual ~AudioConsumer() {} - - virtual void Consume(short *input, int length) = 0; - }; - -}; - -#endif - diff --git a/3rdparty/chromaprint/src/audio_processor.cpp b/3rdparty/chromaprint/src/audio_processor.cpp deleted file mode 100644 index 5d8a43a97..000000000 --- a/3rdparty/chromaprint/src/audio_processor.cpp +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#include -#include -#include -extern "C" { -#include "avresample/avcodec.h" -} -#include "debug.h" -#include "audio_processor.h" - -using namespace std; -using namespace Chromaprint; - -static const int kMinSampleRate = 1000; -static const int kMaxBufferSize = 1024 * 16; - -// Resampler configuration -static const int kResampleFilterLength = 16; -static const int kResamplePhaseCount = 10; -static const int kResampleLinear = 0; -static const double kResampleCutoff = 0.8; - -AudioProcessor::AudioProcessor(int sample_rate, AudioConsumer *consumer) - : m_buffer_size(kMaxBufferSize), - m_target_sample_rate(sample_rate), - m_consumer(consumer), - m_resample_ctx(0) -{ - m_buffer = new short[kMaxBufferSize]; - m_buffer_offset = 0; - m_resample_buffer = new short[kMaxBufferSize]; -} - -AudioProcessor::~AudioProcessor() -{ - if (m_resample_ctx) { - av_resample_close(m_resample_ctx); - } - delete[] m_resample_buffer; - delete[] m_buffer; -} - -void AudioProcessor::LoadMono(short *input, int length) -{ - short *output = m_buffer + m_buffer_offset; - while (length--) { - *output++ = input[0]; - input++; - } -} - -void AudioProcessor::LoadStereo(short *input, int length) -{ - short *output = m_buffer + m_buffer_offset; - while (length--) { - *output++ = (input[0] + input[1]) / 2; - input += 2; - } -} - -void AudioProcessor::LoadMultiChannel(short *input, int length) -{ - short *output = m_buffer + m_buffer_offset; - while (length--) { - long sum = 0; - for (int i = 0; i < m_num_channels; i++) { - sum += *input++; - } - *output++ = (short)(sum / m_num_channels); - } -} - -int AudioProcessor::Load(short *input, int length) -{ - assert(length >= 0); - assert(m_buffer_offset <= m_buffer_size); - length = min(length, m_buffer_size - m_buffer_offset); - switch (m_num_channels) { - case 1: - LoadMono(input, length); - break; - case 2: - LoadStereo(input, length); - break; - default: - LoadMultiChannel(input, length); - break; - } - m_buffer_offset += length; - return length; -} - -void AudioProcessor::Resample() -{ - if (!m_resample_ctx) { - m_consumer->Consume(m_buffer, m_buffer_offset); - m_buffer_offset = 0; - return; - } - int consumed = 0; - int length = av_resample(m_resample_ctx, m_resample_buffer, m_buffer, &consumed, m_buffer_offset, kMaxBufferSize, 1); - if (length > kMaxBufferSize) { - DEBUG() << "Chromaprint::AudioProcessor::Resample() -- Resampling overwrote output buffer.\n"; - length = kMaxBufferSize; - } - m_consumer->Consume(m_resample_buffer, length); - int remaining = m_buffer_offset - consumed; - if (remaining > 0) { - copy(m_buffer + consumed, m_buffer + m_buffer_offset, m_buffer); - } - else if (remaining < 0) { - DEBUG() << "Chromaprint::AudioProcessor::Resample() -- Resampling overread input buffer.\n"; - remaining = 0; - } - m_buffer_offset = remaining; -} - - -bool AudioProcessor::Reset(int sample_rate, int num_channels) -{ - if (num_channels <= 0) { - DEBUG() << "Chromaprint::AudioProcessor::Reset() -- No audio channels.\n"; - return false; - } - if (sample_rate <= kMinSampleRate) { - DEBUG() << "Chromaprint::AudioProcessor::Reset() -- Sample rate less " - << "than " << kMinSampleRate << " (" << sample_rate << ").\n"; - return false; - } - m_buffer_offset = 0; - if (m_resample_ctx) { - av_resample_close(m_resample_ctx); - m_resample_ctx = 0; - } - if (sample_rate != m_target_sample_rate) { - m_resample_ctx = av_resample_init( - m_target_sample_rate, sample_rate, - kResampleFilterLength, - kResamplePhaseCount, - kResampleLinear, - kResampleCutoff); - } - m_num_channels = num_channels; - return true; -} - -void AudioProcessor::Consume(short *input, int length) -{ - assert(length >= 0); - assert(length % m_num_channels == 0); - length /= m_num_channels; - while (length > 0) { - int consumed = Load(input, length); - input += consumed * m_num_channels; - length -= consumed; - if (m_buffer_size == m_buffer_offset) { - Resample(); - if (m_buffer_size == m_buffer_offset) { - DEBUG() << "Chromaprint::AudioProcessor::Consume() -- Resampling failed?\n"; - return; - } - } - } -} - -void AudioProcessor::Flush() -{ - if (m_buffer_offset) { - Resample(); - } -} - diff --git a/3rdparty/chromaprint/src/audio_processor.h b/3rdparty/chromaprint/src/audio_processor.h deleted file mode 100644 index 917805427..000000000 --- a/3rdparty/chromaprint/src/audio_processor.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_AUDIO_PROCESSOR_H_ -#define CHROMAPRINT_AUDIO_PROCESSOR_H_ - -#include "utils.h" -#include "audio_consumer.h" - -struct AVResampleContext; - -namespace Chromaprint -{ - - class AudioProcessor : public AudioConsumer - { - public: - AudioProcessor(int sample_rate, AudioConsumer *consumer); - virtual ~AudioProcessor(); - - int target_sample_rate() const - { - return m_target_sample_rate; - } - - void set_target_sample_rate(int sample_rate) - { - m_target_sample_rate = sample_rate; - } - - AudioConsumer *consumer() const - { - return m_consumer; - } - - void set_consumer(AudioConsumer *consumer) - { - m_consumer = consumer; - } - - //! Prepare for a new audio stream - bool Reset(int sample_rate, int num_channels); - //! Process a chunk of data from the audio stream - void Consume(short *input, int length); - //! Process any buffered input that was not processed before and clear buffers - void Flush(); - - private: - CHROMAPRINT_DISABLE_COPY(AudioProcessor); - - int Load(short *input, int length); - void LoadMono(short *input, int length); - void LoadStereo(short *input, int length); - void LoadMultiChannel(short *input, int length); - void Resample(); - - short *m_buffer; - short *m_resample_buffer; - int m_buffer_offset; - int m_buffer_size; - int m_target_sample_rate; - int m_num_channels; - AudioConsumer *m_consumer; - struct AVResampleContext *m_resample_ctx; - }; - -}; - -#endif - diff --git a/3rdparty/chromaprint/src/avresample/avcodec.h b/3rdparty/chromaprint/src/avresample/avcodec.h deleted file mode 100644 index e1e22c435..000000000 --- a/3rdparty/chromaprint/src/avresample/avcodec.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * copyright (c) 2001 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_H -#define AVCODEC_H - -/* Just a heavily bastardized version of the original file from - * ffmpeg, just enough to get resample2.c to compile without - * modification -- Lennart */ - -#if defined(HAVE_CONFIG_H) -#include -#endif - -#include -#include -#include -#include -#include -#include -#include - -typedef void *AVClass; - -#define av_mallocz(l) calloc(1, (l)) -#define av_malloc(l) malloc(l) -#define av_realloc(p,l) realloc((p),(l)) -#define av_free(p) free(p) - -#ifdef _MSC_VER -#define CHROMAPRINT_C_INLINE __inline -#else -#define CHROMAPRINT_C_INLINE inline -#endif - -static CHROMAPRINT_C_INLINE void av_freep(void *k) { - void **p = (void **)k; - - if (p) { - free(*p); - *p = NULL; - } -} - -static CHROMAPRINT_C_INLINE int av_clip(int a, int amin, int amax) -{ - if (a < amin) return amin; - else if (a > amax) return amax; - else return a; -} - -#define av_log(a,b,c) - -#define FFABS(a) ((a) >= 0 ? (a) : (-(a))) -#define FFSIGN(a) ((a) > 0 ? 1 : -1) - -#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) -#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) - -struct AVResampleContext; -struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff); -int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx); -void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance); -void av_resample_close(struct AVResampleContext *c); -void av_build_filter(int16_t *filter, double factor, int tap_count, int phase_count, int scale, int type); - -/* error handling */ -#if EDOM > 0 -#define AVERROR(e) (-(e)) ///< Returns a negative error code from a POSIX error code, to return from library functions. -#define AVUNERROR(e) (-(e)) ///< Returns a POSIX error code from a library function error return value. -#else -/* Some platforms have E* and errno already negated. */ -#define AVERROR(e) (e) -#define AVUNERROR(e) (e) -#endif - -/* - * crude lrintf for non-C99 systems. - */ -#ifndef HAVE_LRINTF -#define lrintf(x) ((long int)floor(x + 0.5)) -#endif - -#endif /* AVCODEC_H */ diff --git a/3rdparty/chromaprint/src/avresample/dsputil.h b/3rdparty/chromaprint/src/avresample/dsputil.h deleted file mode 100644 index 8da742d0f..000000000 --- a/3rdparty/chromaprint/src/avresample/dsputil.h +++ /dev/null @@ -1 +0,0 @@ -/* empty file, just here to allow us to compile an unmodified resampler2.c */ diff --git a/3rdparty/chromaprint/src/avresample/resample2.c b/3rdparty/chromaprint/src/avresample/resample2.c deleted file mode 100644 index b940059d8..000000000 --- a/3rdparty/chromaprint/src/avresample/resample2.c +++ /dev/null @@ -1,320 +0,0 @@ -/* - * audio resampling - * Copyright (c) 2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * audio resampling - * @author Michael Niedermayer - */ - -#include "avcodec.h" -#include "dsputil.h" - -#ifndef CONFIG_RESAMPLE_HP -#define FILTER_SHIFT 15 - -#define FELEM int16_t -#define FELEM2 int32_t -#define FELEML int64_t -#define FELEM_MAX INT16_MAX -#define FELEM_MIN INT16_MIN -#define WINDOW_TYPE 9 -#elif !defined(CONFIG_RESAMPLE_AUDIOPHILE_KIDDY_MODE) -#define FILTER_SHIFT 30 - -#define FELEM int32_t -#define FELEM2 int64_t -#define FELEML int64_t -#define FELEM_MAX INT32_MAX -#define FELEM_MIN INT32_MIN -#define WINDOW_TYPE 12 -#else -#define FILTER_SHIFT 0 - -#define FELEM double -#define FELEM2 double -#define FELEML double -#define WINDOW_TYPE 24 -#endif - - -typedef struct AVResampleContext{ - const AVClass *av_class; - FELEM *filter_bank; - int filter_length; - int ideal_dst_incr; - int dst_incr; - int index; - int frac; - int src_incr; - int compensation_distance; - int phase_shift; - int phase_mask; - int linear; -}AVResampleContext; - -/** - * 0th order modified bessel function of the first kind. - */ -static double bessel(double x){ - double v=1; - double lastv=0; - double t=1; - int i; - - x= x*x/4; - for(i=1; v != lastv; i++){ - lastv=v; - t *= x/(i*i); - v += t; - } - return v; -} - -/** - * builds a polyphase filterbank. - * @param factor resampling factor - * @param scale wanted sum of coefficients for each filter - * @param type 0->cubic, 1->blackman nuttall windowed sinc, 2..16->kaiser windowed sinc beta=2..16 - * @return 0 on success, negative on error - */ -static int build_filter(FELEM *filter, double factor, int tap_count, int phase_count, int scale, int type){ - int ph, i; - double x, y, w; - double *tab = av_malloc(tap_count * sizeof(*tab)); - const int center= (tap_count-1)/2; - - if (!tab) - return AVERROR(ENOMEM); - - /* if upsampling, only need to interpolate, no filter */ - if (factor > 1.0) - factor = 1.0; - - for(ph=0;phphase_shift= phase_shift; - c->phase_mask= phase_count-1; - c->linear= linear; - - c->filter_length= FFMAX((int)ceil(filter_size/factor), 1); - c->filter_bank= av_mallocz(c->filter_length*(phase_count+1)*sizeof(FELEM)); - if (!c->filter_bank) - goto error; - if (build_filter(c->filter_bank, factor, c->filter_length, phase_count, 1<filter_bank[c->filter_length*phase_count+1], c->filter_bank, (c->filter_length-1)*sizeof(FELEM)); - c->filter_bank[c->filter_length*phase_count]= c->filter_bank[c->filter_length - 1]; - - c->src_incr= out_rate; - c->ideal_dst_incr= c->dst_incr= in_rate * phase_count; - c->index= -phase_count*((c->filter_length-1)/2); - - return c; -error: - av_free(c->filter_bank); - av_free(c); - return NULL; -} - -void av_resample_close(AVResampleContext *c){ - av_freep(&c->filter_bank); - av_freep(&c); -} - -void av_resample_compensate(AVResampleContext *c, int sample_delta, int compensation_distance){ -// sample_delta += (c->ideal_dst_incr - c->dst_incr)*(int64_t)c->compensation_distance / c->ideal_dst_incr; - c->compensation_distance= compensation_distance; - c->dst_incr = c->ideal_dst_incr - c->ideal_dst_incr * (int64_t)sample_delta / compensation_distance; -} - -int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx){ - int dst_index, i; - int index= c->index; - int frac= c->frac; - int dst_incr_frac= c->dst_incr % c->src_incr; - int dst_incr= c->dst_incr / c->src_incr; - int compensation_distance= c->compensation_distance; - - if(compensation_distance == 0 && c->filter_length == 1 && c->phase_shift==0){ - int64_t index2= ((int64_t)index)<<32; - int64_t incr= (1LL<<32) * c->dst_incr / c->src_incr; - dst_size= FFMIN(dst_size, (src_size-1-index) * (int64_t)c->src_incr / c->dst_incr); - - for(dst_index=0; dst_index < dst_size; dst_index++){ - dst[dst_index] = src[index2>>32]; - index2 += incr; - } - frac += dst_index * dst_incr_frac; - index += dst_index * dst_incr; - index += frac / c->src_incr; - frac %= c->src_incr; - }else{ - for(dst_index=0; dst_index < dst_size; dst_index++){ - FELEM *filter= c->filter_bank + c->filter_length*(index & c->phase_mask); - int sample_index= index >> c->phase_shift; - FELEM2 val=0; - - if(sample_index < 0){ - for(i=0; ifilter_length; i++) - val += src[FFABS(sample_index + i) % src_size] * filter[i]; - }else if(sample_index + c->filter_length > src_size){ - break; - }else if(c->linear){ - FELEM2 v2=0; - for(i=0; ifilter_length; i++){ - val += src[sample_index + i] * (FELEM2)filter[i]; - v2 += src[sample_index + i] * (FELEM2)filter[i + c->filter_length]; - } - val+=(v2-val)*(FELEML)frac / c->src_incr; - }else{ - for(i=0; ifilter_length; i++){ - val += src[sample_index + i] * (FELEM2)filter[i]; - } - } - -#ifdef CONFIG_RESAMPLE_AUDIOPHILE_KIDDY_MODE - dst[dst_index] = av_clip_int16(lrintf(val)); -#else - val = (val + (1<<(FILTER_SHIFT-1)))>>FILTER_SHIFT; - dst[dst_index] = (unsigned)(val + 32768) > 65535 ? (val>>31) ^ 32767 : val; -#endif - - frac += dst_incr_frac; - index += dst_incr; - if(frac >= c->src_incr){ - frac -= c->src_incr; - index++; - } - - if(dst_index + 1 == compensation_distance){ - compensation_distance= 0; - dst_incr_frac= c->ideal_dst_incr % c->src_incr; - dst_incr= c->ideal_dst_incr / c->src_incr; - } - } - } - *consumed= FFMAX(index, 0) >> c->phase_shift; - if(index>=0) index &= c->phase_mask; - - if(compensation_distance){ - compensation_distance -= dst_index; - assert(compensation_distance > 0); - } - if(update_ctx){ - c->frac= frac; - c->index= index; - c->dst_incr= dst_incr_frac + c->src_incr*dst_incr; - c->compensation_distance= compensation_distance; - } -#if 0 - if(update_ctx && !c->compensation_distance){ -#undef rand - av_resample_compensate(c, rand() % (8000*2) - 8000, 8000*2); -av_log(NULL, AV_LOG_DEBUG, "%d %d %d\n", c->dst_incr, c->ideal_dst_incr, c->compensation_distance); - } -#endif - - return dst_index; -} diff --git a/3rdparty/chromaprint/src/base64.cpp b/3rdparty/chromaprint/src/base64.cpp deleted file mode 100644 index 0eb37c79a..000000000 --- a/3rdparty/chromaprint/src/base64.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#include -#include -#include "base64.h" -#include "bit_string_writer.h" -#include "debug.h" - -using namespace std; -using namespace Chromaprint; - -static const char kBase64Chars[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; -static const char kBase64CharsReversed[128] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 0, 0, 0, 0, 63, 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 0, 0, 0, 0, 0 -}; - -string Chromaprint::Base64Encode(const string &orig) -{ - int size = orig.size(); - int encoded_size = (size * 4 + 2) / 3; - string encoded(encoded_size, '\x00'); - const unsigned char *src = (unsigned char *)orig.data(); - string::iterator dest = encoded.begin(); - while (size > 0) { - *dest++ = kBase64Chars[(src[0] >> 2)]; - *dest++ = kBase64Chars[((src[0] << 4) | (--size ? (src[1] >> 4) : 0)) & 63]; - if (size) { - *dest++ = kBase64Chars[((src[1] << 2) | (--size ? (src[2] >> 6) : 0)) & 63]; - if (size) { - *dest++ = kBase64Chars[src[2] & 63]; - --size; - } - } - src += 3; - } - return encoded; -} - -string Chromaprint::Base64Decode(const string &encoded) -{ - string str((3 * encoded.size()) / 4, '\x00'); - const unsigned char *src = (const unsigned char *)encoded.data(); - int size = encoded.size(); - string::iterator dest = str.begin(); - while (size > 0) { - int b0 = kBase64CharsReversed[*src++]; - if (--size) { - int b1 = kBase64CharsReversed[*src++]; - int r = (b0 << 2) | (b1 >> 4); - assert(dest != str.end()); - *dest++ = r; - if (--size) { - int b2 = kBase64CharsReversed[*src++]; - r = ((b1 << 4) & 255) | (b2 >> 2); - assert(dest != str.end()); - *dest++ = r; - if (--size) { - int b3 = kBase64CharsReversed[*src++]; - r = ((b2 << 6) & 255) | b3; - assert(dest != str.end()); - *dest++ = r; - --size; - } - } - } - } - return str; -} - diff --git a/3rdparty/chromaprint/src/base64.h b/3rdparty/chromaprint/src/base64.h deleted file mode 100644 index bcae7ac09..000000000 --- a/3rdparty/chromaprint/src/base64.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_BASE64_H_ -#define CHROMAPRINT_BASE64_H_ - -#include - -namespace Chromaprint -{ - - std::string Base64Encode(const std::string &str); - std::string Base64Decode(const std::string &encoded); - -}; - -#endif - diff --git a/3rdparty/chromaprint/src/bit_string_reader.h b/3rdparty/chromaprint/src/bit_string_reader.h deleted file mode 100644 index ecf78e0fa..000000000 --- a/3rdparty/chromaprint/src/bit_string_reader.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_BIT_STRING_READER_H_ -#define CHROMAPRINT_BIT_STRING_READER_H_ - -#include -#include -#include "debug.h" - -namespace Chromaprint -{ - class BitStringReader - { - public: - BitStringReader(const std::string &input) : m_value(input), m_buffer(0), m_buffer_size(0) - { - m_value_iter = m_value.begin(); - } - - uint32_t Read(int bits) - { - if (m_buffer_size < bits) { - if (m_value_iter != m_value.end()) { - m_buffer |= (unsigned char)(*m_value_iter++) << m_buffer_size; - m_buffer_size += 8; - } - } - uint32_t result = m_buffer & ((1 << bits) - 1); - m_buffer >>= bits; - m_buffer_size -= bits; - return result; - } - - void Reset() - { - m_buffer = 0; - m_buffer_size = 0; - } - - private: - - std::string m_value; - std::string::iterator m_value_iter; - uint32_t m_buffer; - int m_buffer_size; - }; - -}; - -#endif - diff --git a/3rdparty/chromaprint/src/bit_string_writer.h b/3rdparty/chromaprint/src/bit_string_writer.h deleted file mode 100644 index c28ca273a..000000000 --- a/3rdparty/chromaprint/src/bit_string_writer.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_BIT_STRING_WRITER_H_ -#define CHROMAPRINT_BIT_STRING_WRITER_H_ - -#include -#include -#include - -namespace Chromaprint -{ - class Classifier; - class Image; - class IntegralImage; - - class BitStringWriter - { - public: - BitStringWriter() : m_buffer(0), m_buffer_size(0) - { - } - - void Write(uint32_t x, int bits) - { - m_buffer |= (x << m_buffer_size); - m_buffer_size += bits; - while (m_buffer_size >= 8) { - m_value.push_back(m_buffer & 255); - m_buffer >>= 8; - m_buffer_size -= 8; - } - } - - void Flush() - { - while (m_buffer_size > 0) { - m_value.push_back(m_buffer & 255); - m_buffer >>= 8; - m_buffer_size -= 8; - } - m_buffer_size = 0; - } - - std::string value() const - { - return m_value; - } - - private: - - std::string m_value; - uint32_t m_buffer; - int m_buffer_size; - }; - -}; - -#endif - diff --git a/3rdparty/chromaprint/src/chroma.cpp b/3rdparty/chromaprint/src/chroma.cpp deleted file mode 100644 index b19d0a58e..000000000 --- a/3rdparty/chromaprint/src/chroma.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#include -#include -#include "fft_frame.h" -#include "utils.h" -#include "chroma.h" -#include "debug.h" - -using namespace std; -using namespace Chromaprint; - -static const int NUM_BANDS = 12; - -inline double FreqToOctave(double freq, double base = 440.0 / 16.0) -{ - return log(freq / base) / log(2.0); -} - -Chroma::Chroma(int min_freq, int max_freq, int frame_size, int sample_rate, FeatureVectorConsumer *consumer) - : m_interpolate(false), - m_notes(frame_size), - m_notes_frac(frame_size), - m_features(NUM_BANDS), - m_consumer(consumer) -{ - PrepareNotes(min_freq, max_freq, frame_size, sample_rate); -} - -Chroma::~Chroma() -{ -} - -void Chroma::PrepareNotes(int min_freq, int max_freq, int frame_size, int sample_rate) -{ - m_min_index = max(1, FreqToIndex(min_freq, frame_size, sample_rate)); - m_max_index = min(frame_size / 2, FreqToIndex(max_freq, frame_size, sample_rate)); - for (int i = m_min_index; i < m_max_index; i++) { - double freq = IndexToFreq(i, frame_size, sample_rate); - double octave = FreqToOctave(freq); - double note = NUM_BANDS * (octave - floor(octave)); - m_notes[i] = (char)note; - m_notes_frac[i] = note - m_notes[i]; - } -} - -void Chroma::Reset() -{ -} - -void Chroma::Consume(const FFTFrame &frame) -{ - fill(m_features.begin(), m_features.end(), 0.0); - for (int i = m_min_index; i < m_max_index; i++) { - int note = m_notes[i]; - double energy = frame.Energy(i); - if (m_interpolate) { - int note2 = note; - double a = 1.0; - if (m_notes_frac[i] < 0.5) { - note2 = (note + NUM_BANDS - 1) % NUM_BANDS; - a = 0.5 + m_notes_frac[i]; - } - if (m_notes_frac[i] > 0.5) { - note2 = (note + 1) % NUM_BANDS; - a = 1.5 - m_notes_frac[i]; - } - m_features[note] += energy * a; - m_features[note2] += energy * (1.0 - a); - } - else { - m_features[note] += energy; - } - } - m_consumer->Consume(m_features); -} - diff --git a/3rdparty/chromaprint/src/chroma.h b/3rdparty/chromaprint/src/chroma.h deleted file mode 100644 index 0183ac1b4..000000000 --- a/3rdparty/chromaprint/src/chroma.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_CHROMA_H_ -#define CHROMAPRINT_CHROMA_H_ - -#include -#include -#include "utils.h" -#include "fft_frame_consumer.h" -#include "feature_vector_consumer.h" - -namespace Chromaprint -{ - - class Chroma : public FFTFrameConsumer - { - public: - Chroma(int min_freq, int max_freq, int frame_size, int sample_rate, FeatureVectorConsumer *consumer); - ~Chroma(); - - bool interpolate() const - { - return m_interpolate; - } - - void set_interpolate(bool interpolate) - { - m_interpolate = interpolate; - } - - void Reset(); - void Consume(const FFTFrame &frame); - - private: - CHROMAPRINT_DISABLE_COPY(Chroma); - - void PrepareNotes(int min_freq, int max_freq, int frame_size, int sample_rate); - - bool m_interpolate; - std::vector m_notes; - std::vector m_notes_frac; - int m_min_index; - int m_max_index; - std::vector m_features; - FeatureVectorConsumer *m_consumer; - }; - -}; - -#endif diff --git a/3rdparty/chromaprint/src/chroma_filter.cpp b/3rdparty/chromaprint/src/chroma_filter.cpp deleted file mode 100644 index 202c3aa34..000000000 --- a/3rdparty/chromaprint/src/chroma_filter.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#include -#include -#include -#include "chroma_filter.h" -#include "utils.h" - -using namespace std; -using namespace Chromaprint; - -ChromaFilter::ChromaFilter(const double *coefficients, int length, FeatureVectorConsumer *consumer) - : m_coefficients(coefficients), - m_length(length), - m_buffer(8), - m_result(12), - m_buffer_offset(0), - m_buffer_size(1), - m_consumer(consumer) -{ -} - -ChromaFilter::~ChromaFilter() -{ -} - -void ChromaFilter::Reset() -{ - m_buffer_size = 1; - m_buffer_offset = 0; -} - -void ChromaFilter::Consume(std::vector &features) -{ - m_buffer[m_buffer_offset] = features; - m_buffer_offset = (m_buffer_offset + 1) % 8; - if (m_buffer_size >= m_length) { - int offset = (m_buffer_offset + 8 - m_length) % 8; - fill(m_result.begin(), m_result.end(), 0.0); - for (int i = 0; i < 12; i++) { - for (int j = 0; j < m_length; j++) { - m_result[i] += m_buffer[(offset + j) % 8][i] * m_coefficients[j]; - } - } - m_consumer->Consume(m_result); - } - else { - m_buffer_size++; - } -} - diff --git a/3rdparty/chromaprint/src/chroma_filter.h b/3rdparty/chromaprint/src/chroma_filter.h deleted file mode 100644 index 69f6febdc..000000000 --- a/3rdparty/chromaprint/src/chroma_filter.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_CHROMA_FILTER_H_ -#define CHROMAPRINT_CHROMA_FILTER_H_ - -#include -#include "feature_vector_consumer.h" - -namespace Chromaprint -{ - - class ChromaFilter : public FeatureVectorConsumer - { - public: - ChromaFilter(const double *coefficients, int length, FeatureVectorConsumer *consumer); - ~ChromaFilter(); - - void Reset(); - void Consume(std::vector &features); - - FeatureVectorConsumer *consumer() { return m_consumer; } - void set_consumer(FeatureVectorConsumer *consumer) { m_consumer = consumer; } - - private: - const double *m_coefficients; - int m_length; - std::vector< std::vector > m_buffer; - std::vector m_result; - int m_buffer_offset; - int m_buffer_size; - FeatureVectorConsumer *m_consumer; - }; - -}; - -#endif diff --git a/3rdparty/chromaprint/src/chroma_normalizer.h b/3rdparty/chromaprint/src/chroma_normalizer.h deleted file mode 100644 index 33f1ffd6e..000000000 --- a/3rdparty/chromaprint/src/chroma_normalizer.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_CHROMA_NORMALIZER_H_ -#define CHROMAPRINT_CHROMA_NORMALIZER_H_ - -#include -#include -#include "feature_vector_consumer.h" -#include "utils.h" - -namespace Chromaprint -{ - - class ChromaNormalizer : public FeatureVectorConsumer - { - public: - ChromaNormalizer(FeatureVectorConsumer *consumer) : m_consumer(consumer) {} - ~ChromaNormalizer() {} - void Reset() {} - - void Consume(std::vector &features) - { - NormalizeVector(features.begin(), features.end(), - Chromaprint::EuclideanNorm::iterator>, - 0.01); - m_consumer->Consume(features); - } - - private: - CHROMAPRINT_DISABLE_COPY(ChromaNormalizer); - - FeatureVectorConsumer *m_consumer; - }; - -}; - -#endif diff --git a/3rdparty/chromaprint/src/chroma_resampler.cpp b/3rdparty/chromaprint/src/chroma_resampler.cpp deleted file mode 100644 index 6be6c1324..000000000 --- a/3rdparty/chromaprint/src/chroma_resampler.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#include -#include -#include -#include "chroma_resampler.h" -#include "utils.h" - -using namespace std; -using namespace Chromaprint; - -ChromaResampler::ChromaResampler(int factor, FeatureVectorConsumer *consumer) - : m_result(12, 0.0), - m_iteration(0), - m_factor(factor), - m_consumer(consumer) -{ -} - -ChromaResampler::~ChromaResampler() -{ -} - -void ChromaResampler::Reset() -{ - m_iteration = 0; - fill(m_result.begin(), m_result.end(), 0.0); -} - -void ChromaResampler::Consume(std::vector &features) -{ - for (int i = 0; i < 12; i++) { - m_result[i] += features[i]; - } - m_iteration += 1; - if (m_iteration == m_factor) { - for (int i = 0; i < 12; i++) { - m_result[i] /= m_factor; - } - m_consumer->Consume(m_result); - Reset(); - } -} - diff --git a/3rdparty/chromaprint/src/chroma_resampler.h b/3rdparty/chromaprint/src/chroma_resampler.h deleted file mode 100644 index 36eff29e8..000000000 --- a/3rdparty/chromaprint/src/chroma_resampler.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_CHROMA_RESAMPLER_H_ -#define CHROMAPRINT_CHROMA_RESAMPLER_H_ - -#include -#include "image.h" -#include "feature_vector_consumer.h" - -namespace Chromaprint -{ - - class ChromaResampler : public FeatureVectorConsumer - { - public: - ChromaResampler(int factor, FeatureVectorConsumer *consumer); - ~ChromaResampler(); - - void Reset(); - void Consume(std::vector &features); - - FeatureVectorConsumer *consumer() { return m_consumer; } - void set_consumer(FeatureVectorConsumer *consumer) { m_consumer = consumer; } - - private: - std::vector m_result; - int m_iteration; - int m_factor; - FeatureVectorConsumer *m_consumer; - }; - -}; - -#endif diff --git a/3rdparty/chromaprint/src/chromaprint.cpp b/3rdparty/chromaprint/src/chromaprint.cpp deleted file mode 100644 index 0b9792b19..000000000 --- a/3rdparty/chromaprint/src/chromaprint.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#include -#include -#include -#include -#include "fingerprinter.h" -#include "fingerprint_compressor.h" -#include "fingerprint_decompressor.h" -#include "fingerprinter_configuration.h" -#include "base64.h" - -using namespace std; -using namespace Chromaprint; - -extern "C" { - -struct ChromaprintContextPrivate { - int algorithm; - Fingerprinter *fingerprinter; - vector fingerprint; -}; - -#define STR(x) #x -#define VERSION_STR(minor, major, patch) \ - STR(major) "." STR(minor) "." STR(patch) - -static const char *version_str = VERSION_STR( - CHROMAPRINT_VERSION_MAJOR, - CHROMAPRINT_VERSION_MINOR, - CHROMAPRINT_VERSION_PATCH); - -const char *chromaprint_get_version(void) -{ - return version_str; -} - -ChromaprintContext *chromaprint_new(int algorithm) -{ - ChromaprintContextPrivate *ctx = new ChromaprintContextPrivate(); - ctx->algorithm = algorithm; - ctx->fingerprinter = new Fingerprinter(CreateFingerprinterConfiguration(algorithm)); - return (ChromaprintContext *)ctx; -} - -void chromaprint_free(ChromaprintContext *c) -{ - ChromaprintContextPrivate *ctx = (ChromaprintContextPrivate *)c; - delete ctx->fingerprinter; - delete ctx; -} - -int chromaprint_start(ChromaprintContext *c, int sample_rate, int num_channels) -{ - ChromaprintContextPrivate *ctx = (ChromaprintContextPrivate *)c; - return ctx->fingerprinter->Start(sample_rate, num_channels) ? 1 : 0; -} - -int chromaprint_feed(ChromaprintContext *c, void *data, int length) -{ - ChromaprintContextPrivate *ctx = (ChromaprintContextPrivate *)c; - ctx->fingerprinter->Consume((short *)data, length); - return 1; -} - -int chromaprint_finish(ChromaprintContext *c) -{ - ChromaprintContextPrivate *ctx = (ChromaprintContextPrivate *)c; - ctx->fingerprint = ctx->fingerprinter->Finish(); - return 1; -} - -int chromaprint_get_fingerprint(ChromaprintContext *c, char **data) -{ - ChromaprintContextPrivate *ctx = (ChromaprintContextPrivate *)c; - string fp = Chromaprint::Base64Encode(Chromaprint::CompressFingerprint(ctx->fingerprint, ctx->algorithm)); - *data = (char *)malloc(fp.size() + 1); - if (!*data) { - return 0; - } - copy(fp.begin(), fp.end(), *data); - (*data)[fp.size()] = 0; - return 1; -} - -int chromaprint_get_raw_fingerprint(ChromaprintContext *c, void **data, int *size) -{ - ChromaprintContextPrivate *ctx = (ChromaprintContextPrivate *)c; - *data = malloc(sizeof(int32_t) * ctx->fingerprint.size()); - if (!*data) { - return 0; - } - *size = ctx->fingerprint.size(); - copy(ctx->fingerprint.begin(), ctx->fingerprint.end(), *((int32_t **)data)); - return 1; -} - -int chromaprint_encode_fingerprint(void *fp, int size, int algorithm, void **encoded_fp, int *encoded_size, int base64) -{ - vector uncompressed = vector((int32_t *)fp, (int32_t *)fp + size); - string compressed = Chromaprint::CompressFingerprint(uncompressed, algorithm); - if (!base64) { - *encoded_fp = malloc(compressed.size()); - *encoded_size = compressed.size(); - copy(compressed.begin(), compressed.end(), (char *)*encoded_fp); - return 1; - } - string encoded = Chromaprint::Base64Encode(compressed); - *encoded_fp = malloc(encoded.size() + 1); - *encoded_size = encoded.size(); - copy(encoded.begin(), encoded.end(), (char *)*encoded_fp); - ((char *)*encoded_fp)[encoded.size()] = 0; - return 1; -} - -int chromaprint_decode_fingerprint(void *encoded_fp, int encoded_size, void **fp, int *size, int *algorithm, int base64) -{ - string encoded = string((char *)encoded_fp, encoded_size); - string compressed = base64 ? Chromaprint::Base64Decode(encoded) : encoded; - vector uncompressed = Chromaprint::DecompressFingerprint(compressed, algorithm); - *fp = malloc(sizeof(int32_t) * uncompressed.size()); - *size = uncompressed.size(); - copy(uncompressed.begin(), uncompressed.end(), (int32_t *)*fp); - return 0; -} - -void chromaprint_dealloc(void *ptr) -{ - free(ptr); -} - -} diff --git a/3rdparty/chromaprint/src/chromaprint.h b/3rdparty/chromaprint/src/chromaprint.h deleted file mode 100644 index e7cbe89d0..000000000 --- a/3rdparty/chromaprint/src/chromaprint.h +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_CHROMAPRINT_H_ -#define CHROMAPRINT_CHROMAPRINT_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#if (defined(_WIN32) || defined(_WIN64)) -# ifdef CHROMAPRINT_NODLL -# define CHROMAPRINT_API -# else -# ifdef CHROMAPRINT_API_EXPORTS -# define CHROMAPRINT_API __declspec(dllexport) -# else -# define CHROMAPRINT_API __declspec(dllimport) -# endif -# endif -#else -# if __GNUC__ >= 4 -# define CHROMAPRINT_API __attribute__ ((visibility("default"))) -# else -# define CHROMAPRINT_API -# endif -#endif - -typedef void *ChromaprintContext; - -#define CHROMAPRINT_VERSION_MAJOR 0 -#define CHROMAPRINT_VERSION_MINOR 6 -#define CHROMAPRINT_VERSION_PATCH 0 - -enum ChromaprintAlgorithm { - CHROMAPRINT_ALGORITHM_TEST1 = 0, - CHROMAPRINT_ALGORITHM_TEST2, - CHROMAPRINT_ALGORITHM_TEST3 -}; - -#define CHROMAPRINT_ALGORITHM_DEFAULT CHROMAPRINT_ALGORITHM_TEST2 - -/** - * Return the version number of Chromaprint. - */ -CHROMAPRINT_API const char *chromaprint_get_version(void); - -/** - * Allocate and initialize the Chromaprint context. - * - * Parameters: - * - version: Version of the fingerprint algorithm, use - * CHROMAPRINT_ALGORITHM_DEFAULT for the default - * algorithm - * - * Returns: - * - Chromaprint context pointer - */ -CHROMAPRINT_API ChromaprintContext *chromaprint_new(int algorithm); - -/** - * Deallocate the Chromaprint context. - * - * Parameters: - * - ctx: Chromaprint context pointer - */ -CHROMAPRINT_API void chromaprint_free(ChromaprintContext *ctx); - -/** - * Return the fingerprint algorithm this context is configured to use. - */ -CHROMAPRINT_API int chromaprint_get_algorithm(ChromaprintContext *ctx); - -/** - * Restart the computation of a fingerprint with a new audio stream. - * - * Parameters: - * - ctx: Chromaprint context pointer - * - sample_rate: sample rate of the audio stream (in Hz) - * - num_channels: numbers of channels in the audio stream (1 or 2) - * - * Returns: - * - 0 on error, 1 on success - */ -CHROMAPRINT_API int chromaprint_start(ChromaprintContext *ctx, int sample_rate, int num_channels); - -/** - * Send audio data to the fingerprint calculator. - * - * Parameters: - * - ctx: Chromaprint context pointer - * - data: raw audio data, should point to an array of 16-bit signed - * integers in native byte-order - * - size: size of the data buffer (in samples) - * - * Returns: - * - 0 on error, 1 on success - */ -CHROMAPRINT_API int chromaprint_feed(ChromaprintContext *ctx, void *data, int size); - -/** - * Process any remaining buffered audio data and calculate the fingerprint. - * - * Parameters: - * - ctx: Chromaprint context pointer - * - * Returns: - * - 0 on error, 1 on success - */ -CHROMAPRINT_API int chromaprint_finish(ChromaprintContext *ctx); - -/** - * Return the calculated fingerprint as a compressed string. - * - * The caller is responsible for freeing the returned pointer using - * chromaprint_dealloc(). - * - * Parameters: - * - ctx: Chromaprint context pointer - * - fingerprint: pointer to a pointer, where a pointer to the allocated array - * will be stored - * - * Returns: - * - 0 on error, 1 on success - */ -CHROMAPRINT_API int chromaprint_get_fingerprint(ChromaprintContext *ctx, char **fingerprint); - -/** - * Return the calculated fingerprint as an array of 32-bit integers. - * - * The caller is responsible for freeing the returned pointer using - * chromaprint_dealloc(). - * - * Parameters: - * - ctx: Chromaprint context pointer - * - fingerprint: pointer to a pointer, where a pointer to the allocated array - * will be stored - * - size: number of items in the returned raw fingerprint - * - * Returns: - * - 0 on error, 1 on success - */ -CHROMAPRINT_API int chromaprint_get_raw_fingerprint(ChromaprintContext *ctx, void **fingerprint, int *size); - -/** - * Compress and optionally base64-encode a raw fingerprint - * - * The caller is responsible for freeing the returned pointer using - * chromaprint_dealloc(). - * - * Parameters: - * - fp: pointer to an array of 32-bit integers representing the raw - * fingerprint to be encoded - * - size: number of items in the raw fingerprint - * - algorithm: Chromaprint algorithm version which was used to generate the - * raw fingerprint - * - encoded_fp: pointer to a pointer, where the encoded fingerprint will be - * stored - * - encoded_size: size of the encoded fingerprint in bytes - * - base64: Whether to return binary data or base64-encoded ASCII data. The - * compressed fingerprint will be encoded using base64 with the - * URL-safe scheme if you set this parameter to 1. It will return - * binary data if it's 0. - * - * Returns: - * - 0 on error, 1 on success - */ -CHROMAPRINT_API int chromaprint_encode_fingerprint(void *fp, int size, int algorithm, void **encoded_fp, int *encoded_size, int base64); - -/** - * Uncompress and optionally base64-decode an encoded fingerprint - * - * The caller is responsible for freeing the returned pointer using - * chromaprint_dealloc(). - * - * Parameters: - * - encoded_fp: Pointer to an encoded fingerprint - * - encoded_size: Size of the encoded fingerprint in bytes - * - fp: Pointer to a pointer, where the decoded raw fingerprint (array - * of 32-bit integers) will be stored - * - size: Number of items in the returned raw fingerprint - * - algorithm: Chromaprint algorithm version which was used to generate the - * raw fingerprint - * - base64: Whether the encoded_fp parameter contains binary data or - * base64-encoded ASCII data. If 1, it will base64-decode the data - * before uncompressing the fingerprint. - * - * Returns: - * - 0 on error, 1 on success - */ -CHROMAPRINT_API int chromaprint_decode_fingerprint(void *encoded_fp, int encoded_size, void **fp, int *size, int *algorithm, int base64); - -/** - * Free memory allocated by any function from the Chromaprint API. - * - * Parameters: - * - ptr: Pointer to be deallocated - */ -CHROMAPRINT_API void chromaprint_dealloc(void *ptr); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/3rdparty/chromaprint/src/classifier.h b/3rdparty/chromaprint/src/classifier.h deleted file mode 100644 index 919e64273..000000000 --- a/3rdparty/chromaprint/src/classifier.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_CLASSIFIER_H_ -#define CHROMAPRINT_CLASSIFIER_H_ - -#include -#include "quantizer.h" -#include "filter.h" -#include "integral_image.h" - -namespace Chromaprint -{ - - class Classifier - { - public: - Classifier(const Filter &filter = Filter(), const Quantizer &quantizer = Quantizer()) - : m_filter(filter), m_quantizer(quantizer) - { - } - - int Classify(IntegralImage *image, int offset) const - { - double value = m_filter.Apply(image, offset); - return m_quantizer.Quantize(value); - } - - const Filter &filter() const { return m_filter; } - const Quantizer &quantizer() const { return m_quantizer; } - - private: - Filter m_filter; - Quantizer m_quantizer; - }; - - inline std::ostream &operator<<(std::ostream &stream, const Classifier &q) - { - stream << "Classifier(" << q.filter() << ", " << q.quantizer() << ")"; - return stream; - } -}; - -#endif diff --git a/3rdparty/chromaprint/src/combined_buffer.h b/3rdparty/chromaprint/src/combined_buffer.h deleted file mode 100644 index 68eb3fbbc..000000000 --- a/3rdparty/chromaprint/src/combined_buffer.h +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_COMBINED_BUFFER_H_ -#define CHROMAPRINT_COMBINED_BUFFER_H_ - -#include -#include -#include - -namespace Chromaprint -{ - - template - class CombinedBuffer; - - template - class _CombinedBufferIterator - { - public: - typedef std::input_iterator_tag iterator_category; - typedef T value_type; - typedef int difference_type; - typedef T* pointer; - typedef T& reference; - - _CombinedBufferIterator(CombinedBuffer *buffer = 0, int pos = 0) - : m_buffer(buffer) - { - pos += buffer->Offset(); - if (pos < buffer->BufferSize(0)) { - m_ptr = buffer->Buffer(0) + pos; - m_ptr_end = buffer->Buffer(0) + buffer->BufferSize(0); - } - else { - pos -= buffer->BufferSize(0); - m_ptr = buffer->Buffer(1) + pos; - m_ptr_end = buffer->Buffer(1) + buffer->BufferSize(1); - } - } - - _CombinedBufferIterator &operator=(const _CombinedBufferIterator &rhs) - { - m_buffer = rhs.m_buffer; - m_ptr = rhs.m_ptr; - m_ptr_end = rhs.m_pre_end; - return *this; - } - - bool operator==(const _CombinedBufferIterator &rhs) const - { - return (m_ptr == rhs.m_ptr) && (m_buffer == rhs.m_buffer); - } - - bool operator!=(const _CombinedBufferIterator &rhs) const - { - return !(operator==(rhs)); - } - - void operator++() - { - ++m_ptr; - if (m_ptr >= m_ptr_end) { - if (m_ptr_end == m_buffer->Buffer(0) + m_buffer->BufferSize(0)) { - m_ptr = m_buffer->Buffer(1); - m_ptr_end = m_buffer->Buffer(1) + m_buffer->BufferSize(1); - } - } - } - - void operator++(int) - { - ++(*this); - } - - short &operator*() - { - assert(m_ptr); - return *m_ptr; - } - - private: - CombinedBuffer *m_buffer; - T *m_ptr_end; - T *m_ptr; - }; - - template - class CombinedBuffer - { - public: - typedef _CombinedBufferIterator Iterator; - - CombinedBuffer(T *buffer1, int size1, T *buffer2, int size2) - : m_offset(0) - { - m_buffer[0] = buffer1; - m_buffer[1] = buffer2; - m_buffer[2] = 0; - m_size[0] = size1; - m_size[1] = size2; - m_size[2] = -1; - } - - int Size() - { - return m_size[0] + m_size[1] - m_offset; - } - - int Shift(int shift) - { - m_offset += shift; - return m_offset; - } - - int Offset() const - { - return m_offset; - } - - Iterator Begin() - { - return Iterator(this, 0); - } - - Iterator End() - { - return Iterator(this, Size()); - } - - T &operator[](int i) - { - i += m_offset; - if (i < m_size[0]) { - return m_buffer[0][i]; - } - i -= m_size[0]; - return m_buffer[1][i]; - } - - T *Buffer(int i) - { - return m_buffer[i]; - } - - int BufferSize(int i) - { - return m_size[i]; - } - - private: - T *m_buffer[3]; - int m_size[3]; - int m_offset; - }; - -}; - -#endif diff --git a/3rdparty/chromaprint/src/debug.h b/3rdparty/chromaprint/src/debug.h deleted file mode 100644 index 075cdf8cf..000000000 --- a/3rdparty/chromaprint/src/debug.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_DEBUG_H_ -#define CHROMAPRINT_DEBUG_H_ - -#ifdef NDEBUG -#include -#else -#include -#endif - -namespace Chromaprint -{ - -#ifdef NDEBUG -extern std::ostream noop_ostream; -#define DEBUG() if (true) {} else noop_ostream -#else -#define DEBUG() std::cerr -#endif - -}; - -#endif diff --git a/3rdparty/chromaprint/src/decoder.h b/3rdparty/chromaprint/src/decoder.h deleted file mode 100644 index 77e24fbfb..000000000 --- a/3rdparty/chromaprint/src/decoder.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef CHROMAPRINT_DECODER_H_ -#define CHROMAPRINT_DECODER_H_ - -namespace Chromaprint -{ - - class Decoder - { - public: - - }; - -}; - -#endif diff --git a/3rdparty/chromaprint/src/ext/audio_dumper.h b/3rdparty/chromaprint/src/ext/audio_dumper.h deleted file mode 100644 index b7795b6e6..000000000 --- a/3rdparty/chromaprint/src/ext/audio_dumper.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef CHROMAPRINT_EXT_AUDIO_DUMPER_H_ -#define CHROMAPRINT_EXT_AUDIO_DUMPER_H_ - -#include -#include -#include "audio_consumer.h" - -class AudioDumper : public Chromaprint::AudioConsumer -{ -public: - AudioDumper(const std::string &file_name) - { - m_file = fopen(file_name.c_str(), "wb"); - } - - ~AudioDumper() - { - fclose(m_file); - } - - void Consume(short *input, int length) - { - fwrite(input, sizeof(short), length, m_file); - } - -private: - FILE *m_file; -}; - -#endif diff --git a/3rdparty/chromaprint/src/ext/ffmpeg_decoder.h b/3rdparty/chromaprint/src/ext/ffmpeg_decoder.h deleted file mode 100644 index f8d34c714..000000000 --- a/3rdparty/chromaprint/src/ext/ffmpeg_decoder.h +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef FFMPEG_DECODER_H_ -#define FFMPEG_DECODER_H_ - -#include -extern "C" { -#include -#include -} -#include "audio_consumer.h" - -class Decoder -{ -public: - Decoder(const std::string &file_name); - ~Decoder(); - - bool Open(); - void Decode(Chromaprint::AudioConsumer *consumer, int max_length = 0); - - int Channels() - { - return m_codec_ctx->channels; - } - - int SampleRate() - { - return m_codec_ctx->sample_rate; - } - - std::string LastError() - { - return m_error; - } - -private: - static const int BUFFER_SIZE = AVCODEC_MAX_AUDIO_FRAME_SIZE * 2; - uint8_t *m_buffer1; - uint8_t *m_buffer2; - std::string m_file_name; - std::string m_error; - AVFormatContext *m_format_ctx; - AVCodecContext *m_codec_ctx; - AVStream *m_stream; - //AVAudioConvert *m_convert_ctx; -}; - -inline Decoder::Decoder(const std::string &file_name) - : m_file_name(file_name), m_format_ctx(0), m_codec_ctx(0), m_stream(0) - /*, m_convert_ctx(0)*/ -{ - av_register_all(); - av_log_set_level(AV_LOG_ERROR); - m_buffer1 = (uint8_t *)av_malloc(BUFFER_SIZE); - m_buffer2 = (uint8_t *)av_malloc(BUFFER_SIZE); -} - -inline Decoder::~Decoder() -{ - if (m_codec_ctx) { - avcodec_close(m_codec_ctx); - } - if (m_format_ctx) { - av_close_input_file(m_format_ctx); - } - //av_audio_convert_free(m_convert_ctx); - av_free(m_buffer2); - av_free(m_buffer1); -} - -inline bool Decoder::Open() -{ - if (av_open_input_file(&m_format_ctx, m_file_name.c_str(), NULL, 0, NULL) != 0) { - m_error = "Couldn't open the file." + m_file_name; - return false; - } - - if (av_find_stream_info(m_format_ctx) < 0) { - m_error = "Couldn't find stream information in the file."; - return false; - } - - //dump_format(m_format_ctx, 0, m_file_name.c_str(), 0); - - for (size_t i = 0; i < m_format_ctx->nb_streams; i++) { - AVCodecContext *avctx = m_format_ctx->streams[i]->codec; -#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(52, 20, 0) - if (avctx && avctx->codec_type == CODEC_TYPE_AUDIO) { -#else - if (avctx && avctx->codec_type == AVMEDIA_TYPE_AUDIO) { -#endif - m_stream = m_format_ctx->streams[i]; - m_codec_ctx = avctx; - break; - } - } - if (!m_codec_ctx) { - m_error = "Couldn't find any audio stream in the file."; - return false; - } - - AVCodec *codec = avcodec_find_decoder(m_codec_ctx->codec_id); - if (!codec) { - m_error = "Unknown codec."; - return false; - } - - if (avcodec_open(m_codec_ctx, codec) < 0) { - m_error = "Couldn't open the codec."; - return false; - } - - if (m_codec_ctx->sample_fmt != SAMPLE_FMT_S16) { - m_error = "Unsupported sample format.\n"; - return false; - } - /*m_convert_ctx = av_audio_convert_alloc(SAMPLE_FMT_S16, 1, - m_codec_ctx->sample_fmt, 1, - NULL, 0); - if (!m_convert_ctx) { - m_error = "Cannot create sample format converter."; - return false; - }*/ - - if (Channels() <= 0) { - m_error = "Invalid audio stream (no channels).\n"; - return false; - } - - return true; -} - -#include - -inline void Decoder::Decode(Chromaprint::AudioConsumer *consumer, int max_length) -{ - AVPacket packet, packet_temp; - - int remaining = max_length * SampleRate() * Channels(); - int stop = 0; - - av_init_packet(&packet); - av_init_packet(&packet_temp); - while (!stop) { - if (av_read_frame(m_format_ctx, &packet) < 0) { - // consumer->Flush(); - break; - } - - packet_temp.data = packet.data; - packet_temp.size = packet.size; - while (packet_temp.size > 0) { - int buffer_size = BUFFER_SIZE; -#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(52, 20, 0) - int consumed = avcodec_decode_audio2( - m_codec_ctx, (int16_t *)m_buffer1, &buffer_size, - packet_temp.data, packet_temp.size); -#else - int consumed = avcodec_decode_audio3( - m_codec_ctx, (int16_t *)m_buffer1, &buffer_size, - &packet_temp); -#endif - - if (consumed < 0) { - break; - } - - packet_temp.data += consumed; - packet_temp.size -= consumed; - - if (buffer_size <= 0) { - continue; - } - - int length = buffer_size / 2; - int16_t *audio_buffer = (int16_t *)m_buffer1; - - /*if (m_convert_ctx) { - const void *ibuf[6] = { m_buffer1 }; - void *obuf[6] = { m_buffer2 }; - int istride[6] = { av_get_bits_per_sample_format(m_codec_ctx->sample_fmt) / 8 }; - int ostride[6] = { 2 }; - if (av_audio_convert(m_convert_ctx, obuf, ostride, ibuf, istride, len) < 0) { - break; - } - length = buffer_size / istride[0]; - audio_buffer = (int16_t *)m_buffer2; - }*/ - - if (max_length) { - length = std::min(remaining, length); - } - - consumer->Consume(audio_buffer, length); - - if (max_length) { - remaining -= length; - if (remaining <= 0) { - stop = 1; - break; - } - } - } - - if (packet.data) { - av_free_packet(&packet); - } - } -} - -#endif diff --git a/3rdparty/chromaprint/src/ext/image_utils.cpp b/3rdparty/chromaprint/src/ext/image_utils.cpp deleted file mode 100644 index 3bcdd7a41..000000000 --- a/3rdparty/chromaprint/src/ext/image_utils.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#include -#include "image_utils.h" - -using namespace std; -using namespace Chromaprint; - - diff --git a/3rdparty/chromaprint/src/ext/image_utils.h b/3rdparty/chromaprint/src/ext/image_utils.h deleted file mode 100644 index a0e702788..000000000 --- a/3rdparty/chromaprint/src/ext/image_utils.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_EXT_IMAGE_UTILS_H_ -#define CHROMAPRINT_EXT_IMAGE_UTILS_H_ - -#include -#include -#include -#include -#include -#include "image.h" - -namespace Chromaprint -{ - - //! Export image to a PNG file - inline void ExportImage(Image *data, const std::string &file_name, double power = 1.0) - { - static const int kNumColors = 6; - static int colors[][3] = { - { 0, 0, 0 }, - { 218, 38, 0 }, - { 221, 99, 0 }, - { 255, 253, 0 }, - { 255, 254, 83 }, - { 255, 255, 200 }, - { 255, 255, 255 }, - }; - - png::image image(data->NumRows(), data->NumColumns()); - double min_value = (*data)[0][0], max_value = (*data)[0][0]; - for (size_t y = 0; y < data->NumRows(); y++) { - for (size_t x = 0; x < data->NumColumns(); x++) { - double value = (*data)[y][x]; - min_value = std::min(min_value, value); - max_value = std::max(max_value, value); - } - } - //std::cout << "min_value=" << min_value << "\n"; - //std::cout << "max_value=" << max_value << "\n"; - for (size_t y = 0; y < data->NumRows(); y++) { - for (size_t x = 0; x < data->NumColumns(); x++) { - double value = ((*data)[y][x] - min_value) / (max_value - min_value); - value = pow(value, power); - double color_value = kNumColors * value; - int color_index = int(color_value); - double color_alpha = color_value - color_index; - if (color_index < 0) { - color_index = 0; - color_alpha = 0; - } - else if (color_index > kNumColors) { - color_index = kNumColors; - color_alpha = 0; - } - //std::cout << "value=" << color_value << "\n"; - //std::cout << "alpha=" << color_alpha << "\n"; - int r = colors[color_index][0] + (colors[color_index+1][0] - colors[color_index][0]) * color_alpha; - int g = colors[color_index][1] + (colors[color_index+1][1] - colors[color_index][1]) * color_alpha; - int b = colors[color_index][2] + (colors[color_index+1][2] - colors[color_index][2]) * color_alpha; - //int color = 255 * vlue + 0.5; - image[data->NumColumns()-x-1][y] = png::rgb_pixel(r, g, b); - } - } - image.write(file_name); - } - - //! Export image in a text format (floating point numbers) to any stream - template - void ExportTextImage(ImageType *image, std::ostream &stream) - { - for (int i = 0; i < image->NumRows(); i++) { - for (int j = 0; j < image->NumColumns(); j++) { - stream << image->Row(i)[j] << " "; - } - stream << "\n"; - } - } - - //! Export image in a text format (floating point numbers) to a file - template - void ExportTextImage(ImageType *image, const std::string &file_name) - { - std::fstream out(file_name.c_str(), std::ios::out); - ExportTextImage(image, out); - } - -}; - -#endif diff --git a/3rdparty/chromaprint/src/ext/sox_decoder.h b/3rdparty/chromaprint/src/ext/sox_decoder.h deleted file mode 100644 index 8cf0cfe82..000000000 --- a/3rdparty/chromaprint/src/ext/sox_decoder.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef FFMPEG_DECODER_H_ -#define FFMPEG_DECODER_H_ - -#include -extern "C" { -#include -#include -} -#include "sox_audio_source.h" -#include "audio_consumer.h" - -class Decoder -{ -public: - Decoder(const std::string &file_name); - ~Decoder(); - - bool Open(); - void Decode(Chromaprint::AudioConsumer *consumer, int max_length = 0); - - int Channels() - { - return m_source->Channels(); - } - - int SampleRate() - { - return m_source->SampleRate(); - } - - std::string LastError() - { - return ""; - // return m_error; - } - -private: - SoxAudioSource *m_source; - short m_buffer[1024]; -}; - -inline Decoder::Decoder(const std::string &file_name) -{ - m_source = new SoxAudioSource(file_name); - m_source->Open(); -} - -inline Decoder::~Decoder() -{ - delete m_source; -} - -inline bool Decoder::Open() -{ - return true; -} - -#include - -inline void Decoder::Decode(Chromaprint::AudioConsumer *consumer, int max_length) -{ - int remaining = SampleRate() * Channels() * max_length; - while (true) { - int res = m_source->Read(m_buffer, size_t(1024)); - if (res <= 0) { - break; - } - if (max_length) { - res = std::min(res, remaining); - } - consumer->Consume(m_buffer, res); - if (max_length) { - remaining -= res; - if (res <= 0) { - break; - } - } - } -} - -#endif diff --git a/3rdparty/chromaprint/src/feature_vector_consumer.h b/3rdparty/chromaprint/src/feature_vector_consumer.h deleted file mode 100644 index 305aed970..000000000 --- a/3rdparty/chromaprint/src/feature_vector_consumer.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_FEATURE_VECTOR_CONSUMER_H_ -#define CHROMAPRINT_FEATURE_VECTOR_CONSUMER_H_ - -#include - -namespace Chromaprint -{ - - class FeatureVectorConsumer - { - public: - virtual ~FeatureVectorConsumer() {} - virtual void Consume(std::vector &features) = 0; - }; - -}; - -#endif - diff --git a/3rdparty/chromaprint/src/fft.cpp b/3rdparty/chromaprint/src/fft.cpp deleted file mode 100644 index 406f8a969..000000000 --- a/3rdparty/chromaprint/src/fft.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#include -#include "utils.h" -#include "fft_lib.h" -#include "fft.h" -#include "debug.h" - -using namespace std; -using namespace Chromaprint; - -FFT::FFT(int frame_size, int overlap, FFTFrameConsumer *consumer) - : m_window(new double[frame_size]), - m_buffer_offset(0), - m_buffer(new short[frame_size]), - m_frame(frame_size), - m_frame_size(frame_size), - m_increment(frame_size - overlap), - m_consumer(consumer) -{ - PrepareHammingWindow(m_window, m_window + frame_size); - for (int i = 0; i < frame_size; i++) { - m_window[i] /= numeric_limits::max(); - } - m_lib = new FFTLib(frame_size, m_window); -} - -FFT::~FFT() -{ - delete m_lib; - delete[] m_buffer; - delete[] m_window; -} - -void FFT::Reset() -{ - m_buffer_offset = 0; -} - -void FFT::Consume(short *input, int length) -{ - // Special case, just pre-filling the buffer - if (m_buffer_offset + length < m_frame_size) { - copy(input, input + length, m_buffer + m_buffer_offset); - m_buffer_offset += length; - return; - } - // Apply FFT on the available data - CombinedBuffer combined_buffer(m_buffer, m_buffer_offset, input, length); - while (combined_buffer.Size() >= m_frame_size) { - m_lib->ComputeFrame(combined_buffer.Begin(), m_frame.data()); - m_consumer->Consume(m_frame); - combined_buffer.Shift(m_increment); - } - // Copy the remaining input data to the internal buffer - copy(combined_buffer.Begin(), combined_buffer.End(), m_buffer); - m_buffer_offset = combined_buffer.Size(); -} - diff --git a/3rdparty/chromaprint/src/fft.h b/3rdparty/chromaprint/src/fft.h deleted file mode 100644 index 4657e9195..000000000 --- a/3rdparty/chromaprint/src/fft.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_FFT_H_ -#define CHROMAPRINT_FFT_H_ - -#include -#include "utils.h" -#include "fft_frame.h" -#include "fft_frame_consumer.h" -#include "audio_consumer.h" -#include "combined_buffer.h" - -namespace Chromaprint -{ - class FFTLib; - - class FFT : public AudioConsumer - { - public: - FFT(int frame_size, int overlap, FFTFrameConsumer *consumer); - ~FFT(); - - int FrameSize() const { return m_frame_size; } - int Overlap() const { return m_frame_size - m_increment; } - - void Reset(); - void Consume(short *input, int length); - - private: - CHROMAPRINT_DISABLE_COPY(FFT); - - double *m_window; - int m_buffer_offset; - short *m_buffer; - FFTFrame m_frame; - int m_frame_size; - int m_increment; - FFTLib *m_lib; - FFTFrameConsumer *m_consumer; - }; - -}; - -#endif diff --git a/3rdparty/chromaprint/src/fft_frame.h b/3rdparty/chromaprint/src/fft_frame.h deleted file mode 100644 index d39dddcf9..000000000 --- a/3rdparty/chromaprint/src/fft_frame.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_FFT_FRAME_H_ -#define CHROMAPRINT_FFT_FRAME_H_ - -#include - -namespace Chromaprint -{ - - class FFTFrame - { - public: - FFTFrame(int size) : m_size(size) - { - m_data = new double[size]; - } - - ~FFTFrame() - { - delete[] m_data; - } - - double Magnitude(int i) const - { - return sqrt(Energy(i)); - } - - double Energy(int i) const - { - return m_data[i]; - } - - int size() const - { - return m_size; - } - - double *data() - { - return m_data; - } - - private: - double *m_data; - int m_size; - }; - -}; - -#endif diff --git a/3rdparty/chromaprint/src/fft_frame_consumer.h b/3rdparty/chromaprint/src/fft_frame_consumer.h deleted file mode 100644 index 9952232ea..000000000 --- a/3rdparty/chromaprint/src/fft_frame_consumer.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_FFT_FRAME_CONSUMER_H_ -#define CHROMAPRINT_FFT_FRAME_CONSUMER_H_ - -namespace Chromaprint -{ - - class FFTFrame; - - class FFTFrameConsumer - { - public: - virtual ~FFTFrameConsumer() {} - virtual void Consume(const FFTFrame &frame) = 0; - }; - -}; - -#endif diff --git a/3rdparty/chromaprint/src/fft_lib.h b/3rdparty/chromaprint/src/fft_lib.h deleted file mode 100644 index 5eaea8194..000000000 --- a/3rdparty/chromaprint/src/fft_lib.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_FFT_LIB_H_ -#define CHROMAPRINT_FFT_LIB_H_ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifdef WITH_AVFFT -#include "fft_lib_avfft.h" -#endif - -#ifdef WITH_FFTW3 -#include "fft_lib_fftw3.h" -#endif - -#ifdef WITH_VDSP -#include "fft_lib_vdsp.h" -#endif - -#endif diff --git a/3rdparty/chromaprint/src/fft_lib_avfft.cpp b/3rdparty/chromaprint/src/fft_lib_avfft.cpp deleted file mode 100644 index cdcb47611..000000000 --- a/3rdparty/chromaprint/src/fft_lib_avfft.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -extern "C" { -#include -} - -#include "utils.h" -#include "fft_lib_avfft.h" - -using namespace std; -using namespace Chromaprint; - -FFTLib::FFTLib(int frame_size, double *window) - : m_window(window), - m_frame_size(frame_size) -{ - m_input = (float *)av_mallocz(sizeof(float) * frame_size); - int bits = -1; - while (frame_size) { - bits++; - frame_size >>= 1; - } - m_rdft_ctx = av_rdft_init(bits, DFT_R2C); -} - -FFTLib::~FFTLib() -{ - av_rdft_end(m_rdft_ctx); - av_free(m_input); -} - -void FFTLib::ComputeFrame(CombinedBuffer::Iterator input, double *output) -{ - ApplyWindow(input, m_window, m_input, m_frame_size, 1.0); - av_rdft_calc(m_rdft_ctx, m_input); - float *in_ptr = m_input; - output[0] = in_ptr[0] * in_ptr[0]; - output[m_frame_size / 2] = in_ptr[1] * in_ptr[1]; - output += 1; - in_ptr += 2; - for (int i = 1; i < m_frame_size / 2; i++) { - *output++ = in_ptr[0] * in_ptr[0] + in_ptr[1] * in_ptr[1]; - in_ptr += 2; - } -} - diff --git a/3rdparty/chromaprint/src/fft_lib_avfft.h b/3rdparty/chromaprint/src/fft_lib_avfft.h deleted file mode 100644 index bb0164ddc..000000000 --- a/3rdparty/chromaprint/src/fft_lib_avfft.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_FFT_LIB_AVFFT_H_ -#define CHROMAPRINT_FFT_LIB_AVFFT_H_ - -extern "C" { -#include -} -#include "combined_buffer.h" - -namespace Chromaprint -{ - - class FFTLib - { - public: - FFTLib(int frame_size, double *window); - ~FFTLib(); - - void ComputeFrame(CombinedBuffer::Iterator input, double *output); - - private: - CHROMAPRINT_DISABLE_COPY(FFTLib); - - double *m_window; - int m_frame_size; - float *m_input; - RDFTContext *m_rdft_ctx; - }; - -}; - -#endif diff --git a/3rdparty/chromaprint/src/fft_lib_fftw3.cpp b/3rdparty/chromaprint/src/fft_lib_fftw3.cpp deleted file mode 100644 index efa872659..000000000 --- a/3rdparty/chromaprint/src/fft_lib_fftw3.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#include "utils.h" -#include "fft_lib_fftw3.h" - -using namespace std; -using namespace Chromaprint; - -FFTLib::FFTLib(int frame_size, double *window) - : m_window(window), - m_frame_size(frame_size) -{ - m_input = (double *)fftw_malloc(sizeof(double) * frame_size); - m_output = (double *)fftw_malloc(sizeof(double) * frame_size); - m_plan = fftw_plan_r2r_1d(frame_size, m_input, m_output, FFTW_R2HC, FFTW_ESTIMATE); -} - -FFTLib::~FFTLib() -{ - fftw_destroy_plan(m_plan); - fftw_free(m_input); - fftw_free(m_output); -} - -void FFTLib::ComputeFrame(CombinedBuffer::Iterator input, double *output) -{ - ApplyWindow(input, m_window, m_input, m_frame_size, 1.0); - fftw_execute(m_plan); - double *in_ptr = m_output; - double *rev_in_ptr = m_output + m_frame_size - 1; - output[0] = in_ptr[0] * in_ptr[0]; - output[m_frame_size / 2] = in_ptr[m_frame_size / 2] * in_ptr[m_frame_size / 2]; - in_ptr += 1; - output += 1; - for (int i = 1; i < m_frame_size / 2; i++) { - *output++ = in_ptr[0] * in_ptr[0] + rev_in_ptr[0] * rev_in_ptr[0]; - in_ptr++; - rev_in_ptr--; - } -} diff --git a/3rdparty/chromaprint/src/fft_lib_fftw3.h b/3rdparty/chromaprint/src/fft_lib_fftw3.h deleted file mode 100644 index a21a564d3..000000000 --- a/3rdparty/chromaprint/src/fft_lib_fftw3.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_FFT_LIB_FFTW3_H_ -#define CHROMAPRINT_FFT_LIB_FFTW3_H_ - -#include -#include -#include "combined_buffer.h" - -namespace Chromaprint -{ - - class FFTLib - { - public: - FFTLib(int frame_size, double *window); - ~FFTLib(); - - void ComputeFrame(CombinedBuffer::Iterator input, double *output); - - private: - CHROMAPRINT_DISABLE_COPY(FFTLib); - - double *m_window; - int m_frame_size; - double *m_input; - double *m_output; - fftw_plan m_plan; - }; - -}; - -#endif diff --git a/3rdparty/chromaprint/src/fft_lib_vdsp.cpp b/3rdparty/chromaprint/src/fft_lib_vdsp.cpp deleted file mode 100644 index a15e6199a..000000000 --- a/3rdparty/chromaprint/src/fft_lib_vdsp.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2011 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#include "utils.h" -#include "fft_lib_vdsp.h" - -using namespace std; -using namespace Chromaprint; - -FFTLib::FFTLib(int frame_size, double *window) - : m_window(window), - m_frame_size(frame_size) -{ - double log2n = log2(frame_size); - assert(log2n == int(log2n)); - m_log2n = int(log2n); - m_input = new float[frame_size]; - m_a.realp = new float[frame_size / 2]; - m_a.imagp = new float[frame_size / 2]; - m_setup = vDSP_create_fftsetup(m_log2n, 0); -} - -FFTLib::~FFTLib() -{ - vDSP_destroy_fftsetup(m_setup); - delete[] m_a.realp; - delete[] m_a.imagp; - delete[] m_input; -} - -void FFTLib::ComputeFrame(CombinedBuffer::Iterator input, double *output) -{ - ApplyWindow(input, m_window, m_input, m_frame_size, 1.0); - // XXX we can avoid this ctoz call by changing ApplyWindow, is it worth it? - vDSP_ctoz((DSPComplex *)m_input, 2, &m_a, 1, m_frame_size / 2); - vDSP_fft_zrip(m_setup, &m_a, 1, m_log2n, FFT_FORWARD); - output[0] = m_a.realp[0] * m_a.realp[0]; - output[m_frame_size / 2] = m_a.imagp[0] * m_a.imagp[0]; - output += 1; - for (int i = 1; i < m_frame_size / 2; i++) { - *output++ = m_a.realp[i] * m_a.realp[i] + m_a.imagp[i] * m_a.imagp[i]; - } -} - diff --git a/3rdparty/chromaprint/src/fft_lib_vdsp.h b/3rdparty/chromaprint/src/fft_lib_vdsp.h deleted file mode 100644 index dd7fcc335..000000000 --- a/3rdparty/chromaprint/src/fft_lib_vdsp.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2011 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_FFT_LIB_VDSP_H_ -#define CHROMAPRINT_FFT_LIB_VDSP_H_ - -#include -#include -#include "combined_buffer.h" - -namespace Chromaprint -{ - - class FFTLib - { - public: - FFTLib(int frame_size, double *window); - ~FFTLib(); - - void ComputeFrame(CombinedBuffer::Iterator input, double *output); - - private: - CHROMAPRINT_DISABLE_COPY(FFTLib); - - double *m_window; - float *m_input; - int m_frame_size; - int m_log2n; - FFTSetup m_setup; - DSPSplitComplex m_a; - }; - -}; - -#endif diff --git a/3rdparty/chromaprint/src/filter.cpp b/3rdparty/chromaprint/src/filter.cpp deleted file mode 100644 index c87ae0f24..000000000 --- a/3rdparty/chromaprint/src/filter.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#include -#include "filter.h" -#include "filter_utils.h" - -using namespace std; -using namespace Chromaprint; - -#define COMPARE_FUNC SubtractLog - -double Filter::Apply(IntegralImage *image, int x) const -{ - switch (m_type) { - case 0: - return Filter0(image, x, m_y, m_width, m_height, COMPARE_FUNC); - case 1: - return Filter1(image, x, m_y, m_width, m_height, COMPARE_FUNC); - case 2: - return Filter2(image, x, m_y, m_width, m_height, COMPARE_FUNC); - case 3: - return Filter3(image, x, m_y, m_width, m_height, COMPARE_FUNC); - case 4: - return Filter4(image, x, m_y, m_width, m_height, COMPARE_FUNC); - case 5: - return Filter5(image, x, m_y, m_width, m_height, COMPARE_FUNC); - } - return 0.0; -} diff --git a/3rdparty/chromaprint/src/filter.h b/3rdparty/chromaprint/src/filter.h deleted file mode 100644 index 33899e9d5..000000000 --- a/3rdparty/chromaprint/src/filter.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_FILTER_H_ -#define CHROMAPRINT_FILTER_H_ - -#include -#include "integral_image.h" - -namespace Chromaprint -{ - - class Filter - { - public: - Filter(int type = 0, int y = 0, int height = 0, int width = 0) - : m_type(type), m_y(y), m_height(height), m_width(width) - {} - - double Apply(IntegralImage *image, int offset) const; - - int type() const { return m_type; } - void set_type(int type) { m_type = type; } - - int y() const { return m_y; } - void set_y(int y) { m_y = y; } - - int height() const { return m_height; } - void set_height(int height) { m_height = height; } - - int width() const { return m_width; } - void set_width(int width) { m_width = width; } - - private: - int m_type; - int m_y; - int m_height; - int m_width; - }; - - inline std::ostream &operator<<(std::ostream &stream, const Filter &f) - { - stream << "Filter(" << f.type() << ", " << f.y() << ", " - << f.height() << ", " << f.width() << ")"; - return stream; - } - -}; - -#endif diff --git a/3rdparty/chromaprint/src/filter_utils.h b/3rdparty/chromaprint/src/filter_utils.h deleted file mode 100644 index 99dbaf50f..000000000 --- a/3rdparty/chromaprint/src/filter_utils.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_FILTER_UTILS_H_ -#define CHROMAPRINT_FILTER_UTILS_H_ - -#include -#include "integral_image.h" -#include "utils.h" - -namespace Chromaprint -{ - - inline double Subtract(double a, double b) - { - return a - b; - } - - inline double SubtractLog(double a, double b) - { - double r = log(1.0 + a) - log(1.0 + b); - assert(!IsNaN(r)); - return r; - } - - // oooooooooooooooo - // oooooooooooooooo - // oooooooooooooooo - // oooooooooooooooo - template - double Filter0(IntegralImage *image, int x, int y, int w, int h, Comparator cmp) - { - double a = image->Area(x, y, x + w - 1, y + h - 1); - double b = 0; - return cmp(a, b); - } - - // ................ - // ................ - // oooooooooooooooo - // oooooooooooooooo - template - double Filter1(IntegralImage *image, int x, int y, int w, int h, Comparator cmp) - { - int h_2 = h / 2; - - double a = image->Area(x, y + h_2, x + w - 1, y + h - 1); - double b = image->Area(x, y, x + w - 1, y + h_2 - 1); - - return cmp(a, b); - } - - // .......ooooooooo - // .......ooooooooo - // .......ooooooooo - // .......ooooooooo - template - double Filter2(IntegralImage *image, int x, int y, int w, int h, Comparator cmp) - { - int w_2 = w / 2; - - double a = image->Area(x + w_2, y, x + w - 1, y + h - 1); - double b = image->Area(x, y, x + w_2 - 1, y + h - 1); - - return cmp(a, b); - } - - // .......ooooooooo - // .......ooooooooo - // ooooooo......... - // ooooooo......... - template - double Filter3(IntegralImage *image, int x, int y, int w, int h, Comparator cmp) - { - int w_2 = w / 2; - int h_2 = h / 2; - - double a = image->Area(x, y + h_2, x + w_2 - 1, y + h - 1) + - image->Area(x + w_2, y, x + w - 1, y + h_2 - 1); - double b = image->Area(x, y, x + w_2 -1, y + h_2 - 1) + - image->Area(x + w_2, y + h_2, x + w - 1, y + h - 1); - - return cmp(a, b); - } - - // ................ - // oooooooooooooooo - // ................ - template - double Filter4(IntegralImage *image, int x, int y, int w, int h, Comparator cmp) - { - int h_3 = h / 3; - - double a = image->Area(x, y + h_3, x + w - 1, y + 2 * h_3 - 1); - double b = image->Area(x, y, x + w - 1, y + h_3 - 1) + - image->Area(x, y + 2 * h_3, x + w - 1, y + h - 1); - - return cmp(a, b); - } - - // .....oooooo..... - // .....oooooo..... - // .....oooooo..... - // .....oooooo..... - template - double Filter5(IntegralImage *image, int x, int y, int w, int h, Comparator cmp) - { - int w_3 = w / 3; - - double a = image->Area(x + w_3, y, x + 2 * w_3 - 1, y + h - 1); - double b = image->Area(x, y, x + w_3 - 1, y + h - 1) + - image->Area(x + 2 * w_3, y, x + w - 1, y + h - 1); - - return cmp(a, b); - } - -}; - -#endif diff --git a/3rdparty/chromaprint/src/fingerprint_calculator.cpp b/3rdparty/chromaprint/src/fingerprint_calculator.cpp deleted file mode 100644 index 081ca50e4..000000000 --- a/3rdparty/chromaprint/src/fingerprint_calculator.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#include "fingerprint_calculator.h" -#include "classifier.h" -#include "debug.h" -#include "utils.h" - -using namespace std; -using namespace Chromaprint; - -FingerprintCalculator::FingerprintCalculator(const Classifier *classifiers, int num_classifiers) - : m_classifiers(classifiers), m_num_classifiers(num_classifiers) -{ - m_max_filter_width = 0; - for (int i = 0; i < num_classifiers; i++) { - m_max_filter_width = max(m_max_filter_width, classifiers[i].filter().width()); - } - assert(m_max_filter_width > 0); -} - - -vector FingerprintCalculator::Calculate(Image *image) -{ - int length = image->NumRows() - m_max_filter_width + 1; - if (length <= 0) { - DEBUG() << "Chromaprint::FingerprintCalculator::Calculate() -- Not " - << "enough data. Image has " << image->NumRows() << " rows, " - << "needs at least " << m_max_filter_width << " rows.\n"; - return vector(); - } - IntegralImage integral_image(image); - vector fingerprint(length); - for (int i = 0; i < length; i++) { - fingerprint[i] = CalculateSubfingerprint(&integral_image, i); - } - return fingerprint; -} - -int32_t FingerprintCalculator::CalculateSubfingerprint(IntegralImage *image, int offset) -{ - uint32_t bits = 0; - for (int i = 0; i < m_num_classifiers; i++) { - //for (int i = m_num_classifiers - 1; i >= 0; i--) { - bits = (bits << 2) | GrayCode(m_classifiers[i].Classify(image, offset)); - //bits = (bits << 2) | m_classifiers[i].Classify(image, offset); - } - return UnsignedToSigned(bits); -} - diff --git a/3rdparty/chromaprint/src/fingerprint_calculator.h b/3rdparty/chromaprint/src/fingerprint_calculator.h deleted file mode 100644 index 7674bbb66..000000000 --- a/3rdparty/chromaprint/src/fingerprint_calculator.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_FINGERPRINT_CALCULATOR_H_ -#define CHROMAPRINT_FINGERPRINT_CALCULATOR_H_ - -#include -#include - -namespace Chromaprint -{ - class Classifier; - class Image; - class IntegralImage; - - class FingerprintCalculator - { - public: - FingerprintCalculator(const Classifier *classifiers, int num_classifiers); - - std::vector Calculate(Image *image); - - int32_t CalculateSubfingerprint(IntegralImage *image, int offset); - - private: - const Classifier *m_classifiers; - int m_num_classifiers; - int m_max_filter_width; - }; - -}; - -#endif - diff --git a/3rdparty/chromaprint/src/fingerprint_compressor.cpp b/3rdparty/chromaprint/src/fingerprint_compressor.cpp deleted file mode 100644 index 2f33fd918..000000000 --- a/3rdparty/chromaprint/src/fingerprint_compressor.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#include -#include "fingerprint_compressor.h" -#include "bit_string_writer.h" -#include "debug.h" -#include "utils.h" - -using namespace std; -using namespace Chromaprint; - -static const int kMaxNormalValue = 7; -static const int kNormalBits = 3; -static const int kExceptionBits = 5; - -FingerprintCompressor::FingerprintCompressor() -{ -} - -void FingerprintCompressor::ProcessSubfingerprint(uint32_t x) -{ - int bit = 1, last_bit = 0; - while (x != 0) { - if ((x & 1) != 0) { - m_bits.push_back(bit - last_bit); - last_bit = bit; - } - x >>= 1; - bit++; - } - m_bits.push_back(0); -} - -void FingerprintCompressor::WriteNormalBits() -{ - BitStringWriter writer; - for (size_t i = 0; i < m_bits.size(); i++) { - writer.Write(min(int(m_bits[i]), kMaxNormalValue), kNormalBits); - } - writer.Flush(); - m_result += writer.value(); -} - -void FingerprintCompressor::WriteExceptionBits() -{ - BitStringWriter writer; - for (size_t i = 0; i < m_bits.size(); i++) { - if (m_bits[i] >= kMaxNormalValue) { - writer.Write(int(m_bits[i]) - kMaxNormalValue, kExceptionBits); - } - } - writer.Flush(); - m_result += writer.value(); -} - -std::string FingerprintCompressor::Compress(const vector &data, int algorithm) -{ - if (data.size() > 0) { - ProcessSubfingerprint(data[0]); - for (size_t i = 1; i < data.size(); i++) { - ProcessSubfingerprint(data[i] ^ data[i - 1]); - } - } - int length = data.size(); - m_result.resize(4); - m_result[0] = algorithm & 255; - m_result[1] = (length >> 16) & 255; - m_result[2] = (length >> 8) & 255; - m_result[3] = (length ) & 255; - WriteNormalBits(); - WriteExceptionBits(); - return m_result; -} - diff --git a/3rdparty/chromaprint/src/fingerprint_compressor.h b/3rdparty/chromaprint/src/fingerprint_compressor.h deleted file mode 100644 index 1d93d6c47..000000000 --- a/3rdparty/chromaprint/src/fingerprint_compressor.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_FINGERPRINT_COMPRESSOR_H_ -#define CHROMAPRINT_FINGERPRINT_COMPRESSOR_H_ - -#include -#include -#include - -namespace Chromaprint -{ - class Classifier; - class Image; - class IntegralImage; - - class FingerprintCompressor - { - public: - FingerprintCompressor(); - std::string Compress(const std::vector &fingerprint, int algorithm = 0); - - private: - - void WriteNormalBits(); - void WriteExceptionBits(); - void ProcessSubfingerprint(uint32_t); - - std::string m_result; - std::vector m_bits; - }; - - inline std::string CompressFingerprint(const std::vector &data, int algorithm = 0) - { - FingerprintCompressor compressor; - return compressor.Compress(data, algorithm); - } - -}; - -#endif - diff --git a/3rdparty/chromaprint/src/fingerprint_decompressor.cpp b/3rdparty/chromaprint/src/fingerprint_decompressor.cpp deleted file mode 100644 index 812b1f661..000000000 --- a/3rdparty/chromaprint/src/fingerprint_decompressor.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#include "fingerprint_decompressor.h" -#include "debug.h" -#include "utils.h" - -using namespace std; -using namespace Chromaprint; - -static const int kMaxNormalValue = 7; -static const int kNormalBits = 3; -static const int kExceptionBits = 5; - -FingerprintDecompressor::FingerprintDecompressor() -{ -} - -void FingerprintDecompressor::UnpackBits() -{ - int i = 0, last_bit = 0, value = 0; - for (size_t j = 0; j < m_bits.size(); j++) { - int bit = m_bits[j]; - if (bit == 0) { - m_result[i] = (i > 0) ? value ^ m_result[i - 1] : value; - value = 0; - last_bit = 0; - i++; - continue; - } - bit += last_bit; - last_bit = bit; - value |= 1 << (bit - 1); - } -} - -void FingerprintDecompressor::ReadNormalBits(BitStringReader *reader) -{ - size_t i = 0; - while (i < m_result.size()) { - int bit = reader->Read(kNormalBits); - if (bit == 0) { - i++; - } - m_bits.push_back(bit); - } -} - -void FingerprintDecompressor::ReadExceptionBits(BitStringReader *reader) -{ - for (size_t i = 0; i < m_bits.size(); i++) { - if (m_bits[i] == kMaxNormalValue) { - m_bits[i] += reader->Read(kExceptionBits); - } - } -} - -std::vector FingerprintDecompressor::Decompress(const string &data, int *algorithm) -{ - if (algorithm) { - *algorithm = data[0]; - } - int length = - ((unsigned char)(data[1]) << 16) | - ((unsigned char)(data[2]) << 8) | - ((unsigned char)(data[3]) ); - - BitStringReader reader(data); - reader.Read(8); - reader.Read(8); - reader.Read(8); - reader.Read(8); - - m_result = vector(length, -1); - reader.Reset(); - ReadNormalBits(&reader); - reader.Reset(); - ReadExceptionBits(&reader); - UnpackBits(); - return m_result; -} - diff --git a/3rdparty/chromaprint/src/fingerprint_decompressor.h b/3rdparty/chromaprint/src/fingerprint_decompressor.h deleted file mode 100644 index 4e446c9ab..000000000 --- a/3rdparty/chromaprint/src/fingerprint_decompressor.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_FINGERPRINT_DECOMPRESSOR_H_ -#define CHROMAPRINT_FINGERPRINT_DECOMPRESSOR_H_ - -#include -#include -#include -#include "bit_string_reader.h" - -namespace Chromaprint -{ - class FingerprintDecompressor - { - public: - FingerprintDecompressor(); - std::vector Decompress(const std::string &fingerprint, int *algorithm = 0); - - private: - - void ReadNormalBits(BitStringReader *reader); - void ReadExceptionBits(BitStringReader *reader); - void UnpackBits(); - - std::vector m_result; - std::vector m_bits; - }; - - inline std::vector DecompressFingerprint(const std::string &data, int *algorithm = 0) - { - FingerprintDecompressor decompressor; - return decompressor.Decompress(data, algorithm); - } - -}; - -#endif - diff --git a/3rdparty/chromaprint/src/fingerprinter.cpp b/3rdparty/chromaprint/src/fingerprinter.cpp deleted file mode 100644 index bab5222b7..000000000 --- a/3rdparty/chromaprint/src/fingerprinter.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#include "fingerprinter.h" -#include "chroma.h" -#include "chroma_normalizer.h" -#include "chroma_filter.h" -#include "fft.h" -#include "audio_processor.h" -#include "image_builder.h" -#include "fingerprint_calculator.h" -#include "fingerprinter_configuration.h" -#include "classifier.h" -#include "utils.h" - -using namespace std; -using namespace Chromaprint; - -static const int SAMPLE_RATE = 11025; -static const int FRAME_SIZE = 4096; -static const int OVERLAP = FRAME_SIZE - FRAME_SIZE / 3; -static const int MIN_FREQ = 28; -static const int MAX_FREQ = 3520; - -Fingerprinter::Fingerprinter(FingerprinterConfiguration *config) - : m_image(12) -{ - if (!config) { - config = new FingerprinterConfigurationTest1(); - } - m_image_builder = new ImageBuilder(&m_image); - m_chroma_normalizer = new ChromaNormalizer(m_image_builder); - m_chroma_filter = new ChromaFilter(config->filter_coefficients(), config->num_filter_coefficients(), m_chroma_normalizer); - m_chroma = new Chroma(MIN_FREQ, MAX_FREQ, FRAME_SIZE, SAMPLE_RATE, m_chroma_filter); - //m_chroma->set_interpolate(true); - m_fft = new FFT(FRAME_SIZE, OVERLAP, m_chroma); - m_audio_processor = new AudioProcessor(SAMPLE_RATE, m_fft); - m_fingerprint_calculator = new FingerprintCalculator(config->classifiers(), config->num_classifiers()); - m_config = config; -} - -Fingerprinter::~Fingerprinter() -{ - delete m_fingerprint_calculator; - delete m_audio_processor; - delete m_fft; - delete m_chroma; - delete m_chroma_filter; - delete m_chroma_normalizer; - delete m_image_builder; - delete m_config; -} - -bool Fingerprinter::Start(int sample_rate, int num_channels) -{ - if (!m_audio_processor->Reset(sample_rate, num_channels)) { - // FIXME save error message somewhere - return false; - } - m_fft->Reset(); - m_chroma->Reset(); - m_chroma_filter->Reset(); - m_chroma_normalizer->Reset(); - m_image = Image(12); // XXX - m_image_builder->Reset(&m_image); - return true; -} - -void Fingerprinter::Consume(short *samples, int length) -{ - assert(length >= 0); - m_audio_processor->Consume(samples, length); -} - -vector Fingerprinter::Finish() -{ - m_audio_processor->Flush(); - return m_fingerprint_calculator->Calculate(&m_image); -} - diff --git a/3rdparty/chromaprint/src/fingerprinter.h b/3rdparty/chromaprint/src/fingerprinter.h deleted file mode 100644 index 61f8b7a09..000000000 --- a/3rdparty/chromaprint/src/fingerprinter.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_FINGERPRINTER_H_ -#define CHROMAPRINT_FINGERPRINTER_H_ - -#include -#include -#include "image.h" -#include "audio_consumer.h" - -namespace Chromaprint -{ - class ImageBuilder; - class IntegralImage; - class FFT; - class Chroma; - class ChromaNormalizer; - class ChromaFilter; - class AudioProcessor; - class FingerprintCalculator; - class FingerprinterConfiguration; - - class Fingerprinter : public AudioConsumer - { - public: - Fingerprinter(FingerprinterConfiguration *config = 0); - ~Fingerprinter(); - - /** - * Initialize the fingerprinting process. - */ - bool Start(int sample_rate, int num_channels); - - /** - * Process a block of raw audio data. Call this method as many times - * as you need. - */ - void Consume(short *input, int length); - - /** - * Calculate the fingerprint based on the provided audio data. - */ - std::vector Finish(); - - private: - Image m_image; - ImageBuilder *m_image_builder; - Chroma *m_chroma; - ChromaNormalizer *m_chroma_normalizer; - ChromaFilter *m_chroma_filter; - FFT *m_fft; - AudioProcessor *m_audio_processor; - FingerprintCalculator *m_fingerprint_calculator; - FingerprinterConfiguration *m_config; - }; - -}; - -#endif - diff --git a/3rdparty/chromaprint/src/fingerprinter_configuration.cpp b/3rdparty/chromaprint/src/fingerprinter_configuration.cpp deleted file mode 100644 index 7ae5bf93b..000000000 --- a/3rdparty/chromaprint/src/fingerprinter_configuration.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#include "fingerprinter_configuration.h" -#include "utils.h" - -using namespace std; -using namespace Chromaprint; - -static const int kChromaFilterSize = 5; -static const double kChromaFilterCoefficients[] = { 0.25, 0.75, 1.0, 0.75, 0.25 }; - -static const Classifier kClassifiersTest1[16] = { - Classifier(Filter(0, 0, 3, 15), Quantizer(2.10543, 2.45354, 2.69414)), - Classifier(Filter(1, 0, 4, 14), Quantizer(-0.345922, 0.0463746, 0.446251)), - Classifier(Filter(1, 4, 4, 11), Quantizer(-0.392132, 0.0291077, 0.443391)), - Classifier(Filter(3, 0, 4, 14), Quantizer(-0.192851, 0.00583535, 0.204053)), - Classifier(Filter(2, 8, 2, 4), Quantizer(-0.0771619, -0.00991999, 0.0575406)), - Classifier(Filter(5, 6, 2, 15), Quantizer(-0.710437, -0.518954, -0.330402)), - Classifier(Filter(1, 9, 2, 16), Quantizer(-0.353724, -0.0189719, 0.289768)), - Classifier(Filter(3, 4, 2, 10), Quantizer(-0.128418, -0.0285697, 0.0591791)), - Classifier(Filter(3, 9, 2, 16), Quantizer(-0.139052, -0.0228468, 0.0879723)), - Classifier(Filter(2, 1, 3, 6), Quantizer(-0.133562, 0.00669205, 0.155012)), - Classifier(Filter(3, 3, 6, 2), Quantizer(-0.0267, 0.00804829, 0.0459773)), - Classifier(Filter(2, 8, 1, 10), Quantizer(-0.0972417, 0.0152227, 0.129003)), - Classifier(Filter(3, 4, 4, 14), Quantizer(-0.141434, 0.00374515, 0.149935)), - Classifier(Filter(5, 4, 2, 15), Quantizer(-0.64035, -0.466999, -0.285493)), - Classifier(Filter(5, 9, 2, 3), Quantizer(-0.322792, -0.254258, -0.174278)), - Classifier(Filter(2, 1, 8, 4), Quantizer(-0.0741375, -0.00590933, 0.0600357)) -}; - -FingerprinterConfigurationTest1::FingerprinterConfigurationTest1() -{ - set_classifiers(kClassifiersTest1, 16); - set_filter_coefficients(kChromaFilterCoefficients, kChromaFilterSize); - set_interpolate(false); -} - -static const Classifier kClassifiersTest2[16] = { - Classifier(Filter(0, 4, 3, 15), Quantizer(1.98215, 2.35817, 2.63523)), - Classifier(Filter(4, 4, 6, 15), Quantizer(-1.03809, -0.651211, -0.282167)), - Classifier(Filter(1, 0, 4, 16), Quantizer(-0.298702, 0.119262, 0.558497)), - Classifier(Filter(3, 8, 2, 12), Quantizer(-0.105439, 0.0153946, 0.135898)), - Classifier(Filter(3, 4, 4, 8), Quantizer(-0.142891, 0.0258736, 0.200632)), - Classifier(Filter(4, 0, 3, 5), Quantizer(-0.826319, -0.590612, -0.368214)), - Classifier(Filter(1, 2, 2, 9), Quantizer(-0.557409, -0.233035, 0.0534525)), - Classifier(Filter(2, 7, 3, 4), Quantizer(-0.0646826, 0.00620476, 0.0784847)), - Classifier(Filter(2, 6, 2, 16), Quantizer(-0.192387, -0.029699, 0.215855)), - Classifier(Filter(2, 1, 3, 2), Quantizer(-0.0397818, -0.00568076, 0.0292026)), - Classifier(Filter(5, 10, 1, 15), Quantizer(-0.53823, -0.369934, -0.190235)), - Classifier(Filter(3, 6, 2, 10), Quantizer(-0.124877, 0.0296483, 0.139239)), - Classifier(Filter(2, 1, 1, 14), Quantizer(-0.101475, 0.0225617, 0.231971)), - Classifier(Filter(3, 5, 6, 4), Quantizer(-0.0799915, -0.00729616, 0.063262)), - Classifier(Filter(1, 9, 2, 12), Quantizer(-0.272556, 0.019424, 0.302559)), - Classifier(Filter(3, 4, 2, 14), Quantizer(-0.164292, -0.0321188, 0.0846339)), -}; - -FingerprinterConfigurationTest2::FingerprinterConfigurationTest2() -{ - set_classifiers(kClassifiersTest2, 16); - set_filter_coefficients(kChromaFilterCoefficients, kChromaFilterSize); - set_interpolate(false); -} - -static const Classifier kClassifiersTest3[16] = { - Classifier(Filter(0, 4, 3, 15), Quantizer(1.98215, 2.35817, 2.63523)), - Classifier(Filter(4, 4, 6, 15), Quantizer(-1.03809, -0.651211, -0.282167)), - Classifier(Filter(1, 0, 4, 16), Quantizer(-0.298702, 0.119262, 0.558497)), - Classifier(Filter(3, 8, 2, 12), Quantizer(-0.105439, 0.0153946, 0.135898)), - Classifier(Filter(3, 4, 4, 8), Quantizer(-0.142891, 0.0258736, 0.200632)), - Classifier(Filter(4, 0, 3, 5), Quantizer(-0.826319, -0.590612, -0.368214)), - Classifier(Filter(1, 2, 2, 9), Quantizer(-0.557409, -0.233035, 0.0534525)), - Classifier(Filter(2, 7, 3, 4), Quantizer(-0.0646826, 0.00620476, 0.0784847)), - Classifier(Filter(2, 6, 2, 16), Quantizer(-0.192387, -0.029699, 0.215855)), - Classifier(Filter(2, 1, 3, 2), Quantizer(-0.0397818, -0.00568076, 0.0292026)), - Classifier(Filter(5, 10, 1, 15), Quantizer(-0.53823, -0.369934, -0.190235)), - Classifier(Filter(3, 6, 2, 10), Quantizer(-0.124877, 0.0296483, 0.139239)), - Classifier(Filter(2, 1, 1, 14), Quantizer(-0.101475, 0.0225617, 0.231971)), - Classifier(Filter(3, 5, 6, 4), Quantizer(-0.0799915, -0.00729616, 0.063262)), - Classifier(Filter(1, 9, 2, 12), Quantizer(-0.272556, 0.019424, 0.302559)), - Classifier(Filter(3, 4, 2, 14), Quantizer(-0.164292, -0.0321188, 0.0846339)), -}; - -FingerprinterConfigurationTest3::FingerprinterConfigurationTest3() -{ - set_classifiers(kClassifiersTest3, 16); - set_filter_coefficients(kChromaFilterCoefficients, kChromaFilterSize); - set_interpolate(true); -} - diff --git a/3rdparty/chromaprint/src/fingerprinter_configuration.h b/3rdparty/chromaprint/src/fingerprinter_configuration.h deleted file mode 100644 index 69a2d3d29..000000000 --- a/3rdparty/chromaprint/src/fingerprinter_configuration.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_FINGERPRINTER_CONFIGURATION_H_ -#define CHROMAPRINT_FINGERPRINTER_CONFIGURATION_H_ - -#include "classifier.h" -#include "chromaprint.h" - -namespace Chromaprint -{ - class FingerprinterConfiguration - { - public: - - FingerprinterConfiguration() - : m_num_classifiers(0), m_classifiers(0) - { - } - - int num_filter_coefficients() const - { - return m_num_filter_coefficients; - } - - const double *filter_coefficients() const - { - return m_filter_coefficients; - } - - void set_filter_coefficients(const double *filter_coefficients, int size) - { - m_filter_coefficients = filter_coefficients; - m_num_filter_coefficients = size; - } - - int num_classifiers() const - { - return m_num_classifiers; - } - - const Classifier *classifiers() const - { - return m_classifiers; - } - - void set_classifiers(const Classifier *classifiers, int size) - { - m_classifiers = classifiers; - m_num_classifiers = size; - } - - bool interpolate() const - { - return m_interpolate; - } - - void set_interpolate(bool value) - { - m_interpolate = value; - } - - private: - int m_num_classifiers; - const Classifier *m_classifiers; - int m_num_filter_coefficients; - const double *m_filter_coefficients; - bool m_interpolate; - }; - - // Used for http://oxygene.sk/lukas/2010/07/introducing-chromaprint/ - // Trained on a randomly selected test data - class FingerprinterConfigurationTest1 : public FingerprinterConfiguration - { - public: - FingerprinterConfigurationTest1(); - }; - - // Trained on 60k pairs based on eMusic samples (mp3) - class FingerprinterConfigurationTest2 : public FingerprinterConfiguration - { - public: - FingerprinterConfigurationTest2(); - }; - - // Trained on 60k pairs based on eMusic samples with interpolation enabled (mp3) - class FingerprinterConfigurationTest3 : public FingerprinterConfiguration - { - public: - FingerprinterConfigurationTest3(); - }; - - inline FingerprinterConfiguration *CreateFingerprinterConfiguration(int algorithm) - { - switch (algorithm) { - case CHROMAPRINT_ALGORITHM_TEST1: - return new FingerprinterConfigurationTest1(); - case CHROMAPRINT_ALGORITHM_TEST2: - return new FingerprinterConfigurationTest2(); - case CHROMAPRINT_ALGORITHM_TEST3: - return new FingerprinterConfigurationTest3(); - } - return 0; - } - -}; - -#endif - diff --git a/3rdparty/chromaprint/src/image.h b/3rdparty/chromaprint/src/image.h deleted file mode 100644 index 923da7762..000000000 --- a/3rdparty/chromaprint/src/image.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_IMAGE_H_ -#define CHROMAPRINT_IMAGE_H_ - -#include -#include -#include - -namespace Chromaprint -{ - - class Image - { - public: - explicit Image(int columns) : m_columns(columns) - { - } - - Image(int columns, int rows) : m_columns(columns), m_data(columns * rows) - { - } - - template - Image(int columns, Iterator first, Iterator last) : m_columns(columns), m_data(first, last) - { - } - - int NumColumns() const { return m_columns; } - int NumRows() const { return m_data.size() / m_columns; } - - void AddRow(const std::vector &row) - { - m_data.resize(m_data.size() + m_columns); - std::copy(row.begin(), row.end(), m_data.end() - m_columns); - } - - double *Row(int i) - { - assert(0 <= i && i < NumRows()); - return &m_data[m_columns * i]; - } - - double *operator[](int i) - { - return Row(i); - } - - private: - int m_columns; - std::vector m_data; - }; - -}; - -#endif diff --git a/3rdparty/chromaprint/src/image_builder.cpp b/3rdparty/chromaprint/src/image_builder.cpp deleted file mode 100644 index 97e06c6ed..000000000 --- a/3rdparty/chromaprint/src/image_builder.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#include -#include -#include -#include "image_builder.h" - -using namespace std; -using namespace Chromaprint; - -ImageBuilder::ImageBuilder(Image *image) - : m_image(image) -{ -} - -ImageBuilder::~ImageBuilder() -{ -} - -void ImageBuilder::Consume(std::vector &features) -{ - assert(features.size() == (size_t)m_image->NumColumns()); - m_image->AddRow(features); -} - diff --git a/3rdparty/chromaprint/src/image_builder.h b/3rdparty/chromaprint/src/image_builder.h deleted file mode 100644 index 2f8360b7c..000000000 --- a/3rdparty/chromaprint/src/image_builder.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_IMAGE_BUILDER_H_ -#define CHROMAPRINT_IMAGE_BUILDER_H_ - -#include -#include "utils.h" -#include "image.h" -#include "feature_vector_consumer.h" - -namespace Chromaprint -{ - - /** - * Accepts feature vectors and builds a 2D image out of them. - */ - class ImageBuilder : public FeatureVectorConsumer - { - public: - ImageBuilder(Image *image = 0); - ~ImageBuilder(); - - void Reset(Image *image) - { - set_image(image); - } - - void Consume(std::vector &features); - - Image *image() const - { - return m_image; - } - - void set_image(Image *image) - { - m_image = image; - } - - private: - CHROMAPRINT_DISABLE_COPY(ImageBuilder); - - Image *m_image; - }; - -}; - -#endif diff --git a/3rdparty/chromaprint/src/integral_image.cpp b/3rdparty/chromaprint/src/integral_image.cpp deleted file mode 100644 index d89cc648f..000000000 --- a/3rdparty/chromaprint/src/integral_image.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#include "integral_image.h" - -using namespace std; -using namespace Chromaprint; - -void IntegralImage::Transform() -{ - int num_rows = m_image->NumRows(); - int num_columns = m_image->NumColumns(); - double *current = m_image->Row(0) + 1; - double *last = m_image->Row(0); - for (int m = 1; m < num_columns; m++) { - // First column - add value on top - *current = current[0] + current[-1]; - ++current; - } - for (int n = 1; n < num_rows; n++) { - // First row - add value on left - *current = current[0] + last[0]; - ++current; - ++last; - // Add values on left, up and up-left - for (int m = 1; m < num_columns; m++) { - *current = current[0] + current[-1] + last[0] - last[-1]; - ++current; - ++last; - } - } -} diff --git a/3rdparty/chromaprint/src/integral_image.h b/3rdparty/chromaprint/src/integral_image.h deleted file mode 100644 index 641ec4a34..000000000 --- a/3rdparty/chromaprint/src/integral_image.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_INTEGRAL_IMAGE_H_ -#define CHROMAPRINT_INTEGRAL_IMAGE_H_ - -#include "image.h" - -namespace Chromaprint -{ - - /** - * Image transformation that allows us to quickly calculate the sum of - * values in a rectangular area. - * - * http://en.wikipedia.org/wiki/Summed_area_table - */ - class IntegralImage - { - public: - /** - * Construct the integral image. Note that will modify the original - * image in-place, so it will not be usable afterwards. - */ - IntegralImage(Image *image) : m_image(image) - { - Transform(); - } - - //! Number of columns in the image - int NumColumns() const { return m_image->NumColumns(); } - - //! Number of rows in the image - int NumRows() const { return m_image->NumRows(); } - - double *Row(int i) - { - return m_image->Row(i); - } - - double *operator[](int i) - { - return m_image->Row(i); - } - - double Area(int x1, int y1, int x2, int y2) - { - double area = (*m_image)[x2][y2]; - if (x1 > 0) { - area -= (*m_image)[x1-1][y2]; - if (y1 > 0) { - area += (*m_image)[x1-1][y1-1]; - } - } - if (y1 > 0) { - area -= (*m_image)[x2][y1-1]; - } - //std::cout << "Area("< -#include -#include -//#include -#include "lloyds.h" -#include - -using namespace std; - -template -T min(const vector &array) -{ - T m = array.size() ? array[0] : 0; - for (int i = 1; i < array.size(); i++) { - if (array[i] < m) { - m = array[i]; - } - } - return m; -} - -template -T max(const vector &array) -{ - T m = array.size() ? array[0] : 0; - for (int i = 1; i < array.size(); i++) { - if (array[i] > m) { - m = array[i]; - } - } - return m; -} - -inline double sqr(double a) -{ - return a * a; -} - -/*template -ostream &operator<<(ostream &stream, const vector &vec) -{ - for (int i = 0; i < vec.size(); i++) { - if (i != 0) - stream << ", "; - stream << vec[i]; - } - return stream; -}*/ - -vector lloyds(vector &sig, int len) -{ - vector x(len-1); - vector q(len); - - sort(sig.begin(), sig.end()); - - // Set initial endpoints - double sig_min = sig[0]; - double sig_max = sig[sig.size()-1]; - - // Initial parameters - for (int i = 0; i < len; i++) { - q[i] = i * (sig_max - sig_min) / (len - 1) + sig_min; - } - for (int i = 0; i < len - 1; i++) { - x[i] = (q[i] + q[i+1]) / 2; - } - - double reldist = 1.0, dist = 1.0; - double stop_criteria = max(numeric_limits::epsilon() * fabs(sig_max), 1e-7); - double iteration = 0; - while (reldist > stop_criteria) { - iteration++; - reldist = dist; - dist = 0.0; - - size_t sig_it = 0; - for (int i = 0; i < len; i++) { - double sum = 0.0; - int cnt = 0; - while (sig_it < sig.size() && (i == len - 1 || sig[sig_it] < x[i])) { - sum += sig[sig_it]; - dist += sqr(sig[sig_it] - q[i]); - ++cnt; - ++sig_it; - } - if (cnt) { - q[i] = sum / cnt; - } - else if (i == 0) { - q[i] = (sig_min + x[i]) / 2.0; - } - else if (i == len - 1) { - q[i] = (x[i-1] + sig_max) / 2.0; - } - else { - q[i] = (x[i-1] + x[i]) / 2.0; - } - } - - dist /= sig.size(); - reldist = fabs(reldist - dist); - - // Set the endpoints in between the updated quanta - for (int i = 0; i < len - 1; i++) { - x[i] = (q[i] + q[i+1]) / 2.0; - } - } - - return x; -} diff --git a/3rdparty/chromaprint/src/lloyds.h b/3rdparty/chromaprint/src/lloyds.h deleted file mode 100644 index b97f75e0b..000000000 --- a/3rdparty/chromaprint/src/lloyds.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef CHROMAPRINT_EXT_LLOYDS_H_ -#define CHROMAPRINT_EXT_LLOYDS_H_ - -#include - -std::vector lloyds(std::vector &sig, int len); - -template -std::vector lloyds(Iterator first, Iterator last, int len) -{ - std::vector sig(first, last); - return lloyds(sig, len); -} - -#endif diff --git a/3rdparty/chromaprint/src/quantizer.h b/3rdparty/chromaprint/src/quantizer.h deleted file mode 100644 index 3bec85555..000000000 --- a/3rdparty/chromaprint/src/quantizer.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_QUANTIZER_H_ -#define CHROMAPRINT_QUANTIZER_H_ - -#include -#include - -namespace Chromaprint -{ - - class Quantizer - { - public: - Quantizer(double t0 = 0.0, double t1 = 0.0, double t2 = 0.0) - : m_t0(t0), m_t1(t1), m_t2(t2) - { - assert(t0 <= t1 && t1 <= t2); - } - - int Quantize(double value) const - { - if (value < m_t1) { - if (value < m_t0) { - return 0; - } - return 1; - } - else { - if (value < m_t2) { - return 2; - } - return 3; - } - } - - double t0() const { return m_t0; } - void set_t0(double t) { m_t0 = t; } - - double t1() const { return m_t1; } - void set_t1(double t) { m_t1 = t; } - - double t2() const { return m_t2; } - void set_t2(double t) { m_t2 = t; } - - private: - double m_t0, m_t1, m_t2; - }; - - inline std::ostream &operator<<(std::ostream &stream, const Quantizer &q) - { - stream << "Quantizer(" << q.t0() << ", " << q.t1() << ", " << q.t2() << ")"; - return stream; - } - -}; - -#endif diff --git a/3rdparty/chromaprint/src/silence_remover.cpp b/3rdparty/chromaprint/src/silence_remover.cpp deleted file mode 100644 index af7c63e45..000000000 --- a/3rdparty/chromaprint/src/silence_remover.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#include -#include -#include "debug.h" -#include "silence_remover.h" - -using namespace std; -using namespace Chromaprint; - -SilenceRemover::SilenceRemover(AudioConsumer *consumer) - : m_start(true), - m_consumer(consumer) -{ -} - -bool SilenceRemover::Reset(int sample_rate, int num_channels) -{ - if (num_channels != 1) { - DEBUG() << "Chromaprint::SilenceRemover::Reset() -- Expecting mono audio signal.\n"; - return false; - } - m_start = true; - return true; -} - -void SilenceRemover::Consume(short *input, int length) -{ - if (m_start) { - while (length) { - if (*input != 0) { - m_start = false; - break; - } - input++; - length--; - } - } - if (length) { - m_consumer->Consume(input, length); - } -} - -void SilenceRemover::Flush() -{ -} - diff --git a/3rdparty/chromaprint/src/silence_remover.h b/3rdparty/chromaprint/src/silence_remover.h deleted file mode 100644 index 05d87fc52..000000000 --- a/3rdparty/chromaprint/src/silence_remover.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_SILENCE_REMOVER_H_ -#define CHROMAPRINT_SILENCE_REMOVER_H_ - -#include "utils.h" -#include "audio_consumer.h" - -namespace Chromaprint -{ - - class SilenceRemover : public AudioConsumer - { - public: - SilenceRemover(AudioConsumer *consumer); - - AudioConsumer *consumer() const - { - return m_consumer; - } - - void set_consumer(AudioConsumer *consumer) - { - m_consumer = consumer; - } - - bool Reset(int sample_rate, int num_channels); - void Consume(short *input, int length); - void Flush(); - - private: - CHROMAPRINT_DISABLE_COPY(SilenceRemover); - - bool m_start; - AudioConsumer *m_consumer; - }; - -}; - -#endif - diff --git a/3rdparty/chromaprint/src/sox_audio_source.cpp b/3rdparty/chromaprint/src/sox_audio_source.cpp deleted file mode 100644 index 99a07bc51..000000000 --- a/3rdparty/chromaprint/src/sox_audio_source.cpp +++ /dev/null @@ -1,71 +0,0 @@ -#include -#include -#include "sox_audio_source.h" - -using namespace std; - -static const size_t kBufferSize = 2 * 4096; -bool SoxAudioSource::initialized_ = false; - -SoxAudioSource::SoxAudioSource(const string &file_name) - : format_(0), file_name_(file_name) -{ - if (!initialized_) { - sox_init(); - initialized_ = true; - } - buffer_ = new sox_sample_t[kBufferSize]; -} - -SoxAudioSource::~SoxAudioSource() -{ - Close(); - delete[] buffer_; -} - -bool SoxAudioSource::Open() -{ - Close(); - format_ = sox_open_read(file_name_.c_str(), NULL, NULL, NULL); - return format_ != 0; -} - -void SoxAudioSource::Close() -{ - if (format_) { - sox_close(format_); - format_ = 0; - } -} - -int SoxAudioSource::SampleRate() -{ - return static_cast(format_->signal.rate); -} - -int SoxAudioSource::Channels() -{ - return format_->signal.channels; -} - -std::size_t SoxAudioSource::Read(short *buffer, std::size_t size) -{ - size_t remaining = size; - short *ptr = buffer; - while (remaining > 0) { - size_t res = sox_read(format_, buffer_, std::min(remaining, kBufferSize)); - if (res == SOX_EOF || res == 0) { - break; - } - int clips = 0; - for (size_t i = 0; i < res; i++) { - // XXX assumes that short is 16-bit - SOX_SAMPLE_LOCALS; - *ptr++ = SOX_SAMPLE_TO_SIGNED_16BIT(buffer_[i], clips); - } - remaining -= res; - } - //cout << "read " << size - remaining << "\n"; - return size - remaining; -} - diff --git a/3rdparty/chromaprint/src/sox_audio_source.h b/3rdparty/chromaprint/src/sox_audio_source.h deleted file mode 100644 index e20533480..000000000 --- a/3rdparty/chromaprint/src/sox_audio_source.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef FP_SOX_AUDIO_SOURCE_H_ -#define FP_SOX_AUDIO_SOURCE_H_ - -extern "C" { -#include -} -#include - -class SoxAudioSource { -public: - SoxAudioSource(const std::string &file_name); - virtual ~SoxAudioSource(); - - bool Open(); - void Close(); - - virtual int SampleRate(); - virtual int Channels(); - virtual std::size_t Length() { return format_->signal.length; } - virtual std::size_t Read(short *buffer, std::size_t size); - -private: - static bool initialized_; - std::string file_name_; - sox_format_t *format_; - sox_sample_t *buffer_; -}; - -#endif diff --git a/3rdparty/chromaprint/src/spectral_centroid.cpp b/3rdparty/chromaprint/src/spectral_centroid.cpp deleted file mode 100644 index 5b28f5ad5..000000000 --- a/3rdparty/chromaprint/src/spectral_centroid.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * SpectralCentroidprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#include -#include -#include "fft_frame.h" -#include "utils.h" -#include "spectral_centroid.h" - -using namespace std; -using namespace Chromaprint; - -SpectralCentroid::SpectralCentroid(int num_bands, int min_freq, int max_freq, int frame_size, int sample_rate, FeatureVectorConsumer *consumer) - : m_bands(num_bands + 1), - m_features(num_bands), - m_consumer(consumer) -{ - PrepareBands(num_bands, min_freq, max_freq, frame_size, sample_rate); -} - -SpectralCentroid::~SpectralCentroid() -{ -} - -void SpectralCentroid::PrepareBands(int num_bands, int min_freq, int max_freq, int frame_size, int sample_rate) -{ - double min_bark = FreqToBark(min_freq); - double max_bark = FreqToBark(max_freq); - double band_size = (max_bark - min_bark) / num_bands; - - int min_index = FreqToIndex(min_freq, frame_size, sample_rate); - //int max_index = FreqToIndex(max_freq, frame_size, sample_rate); - - m_bands[0] = min_index; - double prev_bark = min_bark; - - for (int i = min_index, b = 0; i < frame_size / 2; i++) { - double freq = IndexToFreq(i, frame_size, sample_rate); - double bark = FreqToBark(freq); - if (bark - prev_bark > band_size) { - b += 1; - prev_bark = bark; - m_bands[b] = i; - if (b >= num_bands) { - break; - } - } - } -} - -void SpectralCentroid::Reset() -{ -} - -void SpectralCentroid::Consume(const FFTFrame &frame) -{ - for (int i = 0; i < NumBands(); i++) { - int first = FirstIndex(i); - int last = LastIndex(i); - double numerator = 0.0; - double denominator = 0.0; - for (int j = first; j < last; j++) { - double s = frame.Energy(j); - numerator += j * s; - denominator += s; - } - double centroid = numerator / denominator; - if (centroid != centroid) - centroid = (first + last) / 2.0; // handle NaN - m_features[i] = (centroid - first) / (last - first); - } - m_consumer->Consume(m_features); -} - diff --git a/3rdparty/chromaprint/src/spectral_centroid.h b/3rdparty/chromaprint/src/spectral_centroid.h deleted file mode 100644 index 1c20039db..000000000 --- a/3rdparty/chromaprint/src/spectral_centroid.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * SpectralCentroidprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_SPECTRAL_CENTROID_H_ -#define CHROMAPRINT_SPECTRAL_CENTROID_H_ - -#include -#include -#include "utils.h" -#include "fft_frame_consumer.h" -#include "feature_vector_consumer.h" - -namespace Chromaprint -{ - - class SpectralCentroid : public FFTFrameConsumer - { - public: - SpectralCentroid(int num_bands, int min_freq, int max_freq, int frame_size, int sample_rate, FeatureVectorConsumer *consumer); - ~SpectralCentroid(); - - void Reset(); - void Consume(const FFTFrame &frame); - - protected: - int NumBands() const { return m_bands.size() - 1; } - int FirstIndex(int band) const { return m_bands[band]; } - int LastIndex(int band) const { return m_bands[band + 1]; } - - private: - CHROMAPRINT_DISABLE_COPY(SpectralCentroid); - - void PrepareBands(int num_bands, int min_freq, int max_freq, int frame_size, int sample_rate); - - std::vector m_bands; - std::vector m_features; - FeatureVectorConsumer *m_consumer; - }; - -}; - -#endif diff --git a/3rdparty/chromaprint/src/spectrum.cpp b/3rdparty/chromaprint/src/spectrum.cpp deleted file mode 100644 index 0d47fe980..000000000 --- a/3rdparty/chromaprint/src/spectrum.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Spectrumprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#include -#include -#include "fft_frame.h" -#include "utils.h" -#include "spectrum.h" - -using namespace std; -using namespace Chromaprint; - -Spectrum::Spectrum(int num_bands, int min_freq, int max_freq, int frame_size, int sample_rate, FeatureVectorConsumer *consumer) - : m_bands(num_bands + 1), - m_features(num_bands), - m_consumer(consumer) -{ - PrepareBands(num_bands, min_freq, max_freq, frame_size, sample_rate); -} - -Spectrum::~Spectrum() -{ -} - -void Spectrum::PrepareBands(int num_bands, int min_freq, int max_freq, int frame_size, int sample_rate) -{ - double min_bark = FreqToBark(min_freq); - double max_bark = FreqToBark(max_freq); - double band_size = (max_bark - min_bark) / num_bands; - - int min_index = FreqToIndex(min_freq, frame_size, sample_rate); - //int max_index = FreqToIndex(max_freq, frame_size, sample_rate); - - m_bands[0] = min_index; - double prev_bark = min_bark; - - for (int i = min_index, b = 0; i < frame_size / 2; i++) { - double freq = IndexToFreq(i, frame_size, sample_rate); - double bark = FreqToBark(freq); - if (bark - prev_bark > band_size) { - b += 1; - prev_bark = bark; - m_bands[b] = i; - if (b >= num_bands) { - break; - } - } - } -} - -void Spectrum::Reset() -{ -} - -void Spectrum::Consume(const FFTFrame &frame) -{ - for (int i = 0; i < NumBands(); i++) { - int first = FirstIndex(i); - int last = LastIndex(i); - double numerator = 0.0; - double denominator = 0.0; - for (int j = first; j < last; j++) { - double s = frame.Energy(j); - numerator += j * s; - denominator += s; - } - m_features[i] = denominator / (last - first); - } - m_consumer->Consume(m_features); -} - diff --git a/3rdparty/chromaprint/src/spectrum.h b/3rdparty/chromaprint/src/spectrum.h deleted file mode 100644 index 1a91a96f3..000000000 --- a/3rdparty/chromaprint/src/spectrum.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * SpectralCentroidprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_SPECTRUM_H_ -#define CHROMAPRINT_SPECTRUM_H_ - -#include -#include -#include "utils.h" -#include "fft_frame_consumer.h" -#include "feature_vector_consumer.h" - -namespace Chromaprint -{ - - class Spectrum : public FFTFrameConsumer - { - public: - Spectrum(int num_bands, int min_freq, int max_freq, int frame_size, int sample_rate, FeatureVectorConsumer *consumer); - ~Spectrum(); - - void Reset(); - void Consume(const FFTFrame &frame); - - protected: - int NumBands() const { return m_bands.size() - 1; } - int FirstIndex(int band) const { return m_bands[band]; } - int LastIndex(int band) const { return m_bands[band + 1]; } - - private: - CHROMAPRINT_DISABLE_COPY(Spectrum); - - void PrepareBands(int num_bands, int min_freq, int max_freq, int frame_size, int sample_rate); - - std::vector m_bands; - std::vector m_features; - FeatureVectorConsumer *m_consumer; - }; - -}; - -#endif diff --git a/3rdparty/chromaprint/src/utils.h b/3rdparty/chromaprint/src/utils.h deleted file mode 100644 index 4a8b7be05..000000000 --- a/3rdparty/chromaprint/src/utils.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Chromaprint -- Audio fingerprinting toolkit - * Copyright (C) 2010 Lukas Lalinsky - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef CHROMAPRINT_UTILS_H_ -#define CHROMAPRINT_UTILS_H_ - -#if defined(HAVE_CONFIG_H) -#include -#endif - -#include -#include -#include -#include -#include -#include - -#ifndef HAVE_ROUND -static inline double round(double x) -{ - if (x >= 0.0) - return floor(x + 0.5); - else - return ceil(x - 0.5); -} -#endif - -#define CHROMAPRINT_DISABLE_COPY(ClassName) \ - ClassName(const ClassName &); \ - void operator=(const ClassName &); - -//#include - -namespace Chromaprint -{ - - template - void PrepareHammingWindow(RandomAccessIterator first, RandomAccessIterator last) - { - size_t i = 0, max_i = last - first - 1; - double scale = 2. * M_PI / max_i; - while (first != last) { - *first++ = 0.54 - 0.46 * cos(scale * i++); - } - } - - template - void ApplyWindow(InputIterator1 input, InputIterator2 window, OutputIterator output, int size, double scale) - { - while (size--) { - *output = *input * *window * scale; - ++input; - ++window; - ++output; - } - } - - template - typename std::iterator_traits::value_type Sum(Iterator first, Iterator last) - { - typename std::iterator_traits::value_type sum = 0; - while (first != last) { - sum += *first; - ++first; - } - return sum; - } - - template - typename std::iterator_traits::value_type EuclideanNorm(Iterator first, Iterator last) - { - typename std::iterator_traits::value_type squares = 0; - while (first != last) { - squares += *first * *first; - ++first; - } - return (squares > 0) ? sqrt(squares) : 0; - } - - template - void NormalizeVector(Iterator first, Iterator last, Func func, double threshold = 0.01) - { - double norm = func(first, last); - if (norm < threshold) { - std::fill(first, last, 0.0); - } - else { - while (first != last) { - *first /= norm; - ++first; - } - } - } - - inline int GrayCode(int i) - { - static const unsigned char CODES[] = { 0, 1, 3, 2 }; - return CODES[i]; - } - - inline double IndexToFreq(int i, int frame_size, int sample_rate) - { - return double(i) * sample_rate / frame_size; - } - - inline int FreqToIndex(double freq, int frame_size, int sample_rate) - { - return (int)round(frame_size * freq / sample_rate); - } - - inline int32_t UnsignedToSigned(uint32_t x) - { - return *((int32_t *)&x); - //return x & 0x80000000 ? x & 0x7FFFFFFF - 0x80000000 : x; - } - - template - inline bool IsNaN(T value) - { - return value != value; - } - - inline double FreqToBark(double f) - { - double z = (26.81 * f) / (1960.0 + f) - 0.53; - - if (z < 2.0) { - z = z + 0.15 * (2.0 - z); - } else if (z > 20.1) { - z = z + 0.22 * (z - 20.1); - } - - return z; - } - -}; - -#endif diff --git a/CMakeLists.txt b/CMakeLists.txt index dafc92332..9d813928c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -388,17 +388,6 @@ else() set(SHA2_LIBRARIES sha2) endif() -# Use our 3rdparty chromaprint if a system one wasn't found -if(NOT CHROMAPRINT_FOUND) - add_subdirectory(3rdparty/chromaprint) - set(CHROMAPRINT_LIBRARIES chromaprint_p) - set(CHROMAPRINT_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/3rdparty/chromaprint/src) - - if(WIN32) - add_definitions(-DCHROMAPRINT_NODLL) - endif(WIN32) -endif(NOT CHROMAPRINT_FOUND) - # Use the system libmygpo-qt if a recent enough version was found if(LIBMYGPO_QT_FOUND) set(MYGPOQT_LIBRARIES ${LIBMYGPO_QT_LIBRARIES})