├── AUTHORS ├── COPYING ├── Makefile.am ├── Makefile.in ├── README ├── aclocal.m4 ├── config.guess ├── config.h.in ├── config.sub ├── configure ├── configure.in ├── depcomp ├── examples ├── COPYING ├── Makefile.am ├── Makefile.in ├── example.cpp ├── protocol.cpp ├── protocol.h ├── uselame.cpp └── wavefile.cpp ├── include ├── Makefile.am ├── Makefile.in └── ofa1 │ ├── Makefile.am │ ├── Makefile.in │ └── ofa.h ├── install-sh ├── lib ├── AFLIB │ ├── Makefile.am │ ├── Makefile.in │ ├── aflibConverter.cpp │ ├── aflibConverter.h │ ├── aflibConverterLargeFilter.h │ └── aflibConverterSmallFilter.h ├── JAMA │ ├── Makefile.am │ ├── Makefile.in │ ├── jama_svd.h │ ├── tnt_array1d.h │ ├── tnt_array1d_utils.h │ ├── tnt_array2d.h │ ├── tnt_array2d_utils.h │ └── tnt_math_utils.h ├── Makefile.am ├── Makefile.in ├── error_op.h ├── fft_op.cpp ├── fft_op.h ├── fftlib_op.h ├── fftlibvdsp_op.cpp ├── fftlibw3_op.cpp ├── frametracker_op.cpp ├── frametracker_op.h ├── mainprint.cpp ├── signal_op.cpp ├── signal_op.h ├── trackdata_op.cpp ├── trackdata_op.h ├── trackframe_op.cpp ├── trackframe_op.h ├── tracklist_op.cpp └── tracklist_op.h ├── libofa.pc.in ├── ltmain.sh └── missing /AUTHORS: -------------------------------------------------------------------------------- 1 | People who have contributed to libofa: 2 | 3 | Frode Holm (frode (at) musicip (dot) com) 4 | Stephen Pope (stp (at) create (dot) ucsb (dot) edu) 5 | Wendell Hicken (whicken (at) musicip (dot) com) 6 | - Initial code 7 | 8 | Robert Kaye (rob (at) eorbit (dot) net) 9 | - Autoconf/libtool wrapping 10 | 11 | Eric Sandeen (sandeen (at) sgi (dot) com) 12 | - Sent in a small patch to avoid a | vs || ambiguity 13 | 14 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanob/libofa/3668beb3c5c17b1c3ffec7eeb3366e1505c3964d/COPYING -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------ 2 | # 3 | # libofa -- the Open Fingerprint Architecture library 4 | # 5 | # Copyright (C) 2006 MusicIP Corporation 6 | # All rights reserved. 7 | # 8 | #------------------------------------------------------------------- 9 | AUTOMAKE_OPTIONS = foreign 10 | 11 | SUBDIRS = include lib examples 12 | DIST_SUBDIRS = include lib examples 13 | 14 | cvsclean: distclean 15 | @echo "additonal cleanup for cvs commits" 16 | rm -f *~ *.exe 17 | rm -f $(PACKAGE)-$(VERSION).tar.gz 18 | 19 | pcdir = $(libdir)/pkgconfig 20 | pc_DATA = libofa.pc 21 | 22 | # README.win32 config_win32.h 23 | EXTRA_DIST = libofa.pc.in README COPYING 24 | 25 | CLEANFILES = stamp-h 26 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | README for the Open Fingerprint Architecture library "LIBOFA" 2 | Copyright (C) 2006, MusicIP Corporation 3 | 605 E. Huntington Dr. Suite 201, Monrovia CA 91016 USA 4 | Ph +1-626-359-9702 Fax +1-626-359-9827 5 | 6 | This program is available as either free software or open source 7 | software. You can redistribute it and/or modify it under the terms of 8 | the GNU General Public License as published by the Free Software 9 | Foundation; either version 2 of the License, OR under the terms of the 10 | Adaptive Public License, as published by the Open Source Initiative 11 | (OSI). 12 | 13 | You must choose one or the other. 14 | Your redistribution of any applications or code will be bound by the 15 | terms of conditions of the license you choose. 16 | 17 | This program is distributed in the hope that it will be useful, but 18 | WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 20 | 21 | ***INFORMAL NOTICES*** 22 | The APL license requires "modest attribution." If you choose this 23 | license, any programs using this library (or derivative works from 24 | this library as defined by the APL) must display the 25 | connected_by_musicIP graphic during execution. If the graphic file has 26 | not been included in the source code files you received, it can be 27 | found at 28 | 29 | http://www.musicip.com/connected_by_musicip.png or 30 | http://www.musicip.com/connected_by_musicip.gif 31 | 32 | This library is by design compatible with the MusicDNS web service. 33 | Non-commercial access to the service *was* available at www.musicdns.org. 34 | (The domain musicdns.org seems to be grabbed by an unrelated third party as of 2016). 35 | -------------------------------------------------------------------------------- /config.h.in: -------------------------------------------------------------------------------- 1 | /* config.h.in. Generated from configure.in by autoheader. */ 2 | 3 | /* Use libfftw3 */ 4 | #undef FFTW3 5 | 6 | /* Define to 1 if you have the header file. */ 7 | #undef HAVE_DLFCN_H 8 | 9 | /* Define to 1 if you have the header file. */ 10 | #undef HAVE_INTTYPES_H 11 | 12 | /* Define to 1 if you have the header file. */ 13 | #undef HAVE_MEMORY_H 14 | 15 | /* Define to 1 if you have the header file. */ 16 | #undef HAVE_STDINT_H 17 | 18 | /* Define to 1 if you have the header file. */ 19 | #undef HAVE_STDLIB_H 20 | 21 | /* Define to 1 if you have the header file. */ 22 | #undef HAVE_STRINGS_H 23 | 24 | /* Define to 1 if you have the header file. */ 25 | #undef HAVE_STRING_H 26 | 27 | /* Define to 1 if you have the header file. */ 28 | #undef HAVE_SYS_STAT_H 29 | 30 | /* Define to 1 if you have the header file. */ 31 | #undef HAVE_SYS_TYPES_H 32 | 33 | /* Define to 1 if you have the header file. */ 34 | #undef HAVE_UNISTD_H 35 | 36 | /* Name of package */ 37 | #undef PACKAGE 38 | 39 | /* Define to the address where bug reports for this package should be sent. */ 40 | #undef PACKAGE_BUGREPORT 41 | 42 | /* Define to the full name of this package. */ 43 | #undef PACKAGE_NAME 44 | 45 | /* Define to the full name and version of this package. */ 46 | #undef PACKAGE_STRING 47 | 48 | /* Define to the one symbol short name of this package. */ 49 | #undef PACKAGE_TARNAME 50 | 51 | /* Define to the version of this package. */ 52 | #undef PACKAGE_VERSION 53 | 54 | /* The size of a `long', as computed by sizeof. */ 55 | #undef SIZEOF_LONG 56 | 57 | /* Define to 1 if you have the ANSI C header files. */ 58 | #undef STDC_HEADERS 59 | 60 | /* Use vDSP */ 61 | #undef VDSP 62 | 63 | /* Version number of package */ 64 | #undef VERSION 65 | 66 | /* Define to 1 if your processor stores words with the most significant byte 67 | first (like Motorola and SPARC, unlike Intel and VAX). */ 68 | #undef WORDS_BIGENDIAN 69 | -------------------------------------------------------------------------------- /configure.in: -------------------------------------------------------------------------------- 1 | dnl Process this file with autoconf to produce a configure script. 2 | AC_INIT(lib/mainprint.cpp) 3 | AM_CONFIG_HEADER(config.h) 4 | VERSION="0.9.3" 5 | AM_INIT_AUTOMAKE(libofa, "$VERSION") 6 | 7 | AM_MAINTAINER_MODE 8 | 9 | dnl Canonicalize host. 10 | AC_CANONICAL_HOST 11 | case "${host_cpu}-${host_os}" in 12 | *-beos*) os=beos; LIBS='-lbe -lroot' ;; 13 | *-cygwin*) os=cygwin ;; 14 | *-freebsd*) os=freebsd ;; 15 | *-darwin*) os=darwin ;; 16 | *-linux*) os=linux ;; 17 | *-netbsd*) os=netbsd ;; 18 | *-openbsd*) os=openbsd ;; 19 | *-os2_emx*) os=os2 ;; 20 | *-solaris*) os=solaris; LIBS='-lsocket -lnsl' ;; 21 | *-qnx*) os=qnx; LIBS='-lsocket' ;; 22 | *) AC_MSG_RESULT([WARNING: unknown system]) ;; 23 | esac 24 | AM_CONDITIONAL(DARWIN, test x$os = xdarwin) 25 | AM_CONDITIONAL(FREEBSD, test x$os = xfreebsd) 26 | 27 | dnl Checks for programs. 28 | AC_PREREQ(2.52) 29 | AC_PROG_AWK 30 | AC_PROG_CC 31 | AC_LIBLTDL_CONVENIENCE 32 | AM_PROG_LIBTOOL 33 | AC_SUBST(LIBTOOL_DEPS) 34 | AC_PROG_CXX 35 | AC_PROG_INSTALL 36 | PREFIX="${prefix}" 37 | AC_SUBST(PREFIX) 38 | AC_C_BIGENDIAN 39 | AC_CHECK_SIZEOF(long) 40 | 41 | if test "$GCC" = yes; then 42 | dnlCFLAGS="$CFLAGS -Wall -O2" 43 | CFLAGS="$CFLAGS -Wall -g" 44 | fi 45 | if test "$GXX" = yes; then 46 | CXXFLAGS="$CXXFLAGS -Wall -g" 47 | fi 48 | 49 | dnl Checks for libraries. 50 | 51 | dnl libexpat check 52 | AC_CHECK_LIB(expat, XML_ExpatVersion, 53 | [EXPAT_LIBS="-lexpat"], [ 54 | echo "*" 55 | echo "* expat is needed to build this library. It is either not" 56 | echo "* installed on your system or it is too old." 57 | echo "* Please download it from http://expat.sourceforge.net." 58 | echo "*" 59 | AC_MSG_ERROR("Cannot build. Stop.")], -lexpat) 60 | AC_SUBST(EXPAT_LIBS) 61 | 62 | dnl libcurl check 63 | AC_CHECK_LIB(curl, curl_global_init, 64 | [CURL_LIBS="-lcurl"], [ 65 | echo "*" 66 | echo "* libcurl is needed to build this library. It is either not" 67 | echo "* installed on your system or it is too old." 68 | echo "* Please download it http://curl.haxx.se/" 69 | echo "*" 70 | AC_MSG_ERROR("Cannot build. Stop.")], -lcurl) 71 | AC_SUBST(CURL_LIBS) 72 | 73 | dnl Support libfftw2 and vSDP and MKL (intel) 74 | dnl FFTW for FFTW v2. FFTW3 for FFTW v3. VDSP for vDSP. MKL for MKL 75 | dnl TODO: PREANSI for win32 76 | 77 | if test x$os = xdarwin; then 78 | AC_MSG_NOTICE([Using vDSP on OS X]) 79 | LIBS="$LIBS -XCClinker -framework -XCClinker Accelerate" 80 | FFT_WRAPPER="fftlibvdsp_op.cpp" 81 | AM_CONDITIONAL(FFTW3, false) 82 | AM_CONDITIONAL(VDSP, true) 83 | AC_DEFINE_UNQUOTED(VDSP, 1, Use vDSP) 84 | else 85 | AC_MSG_NOTICE([Using libfftw3]) 86 | AC_CHECK_LIB(fftw3, fftw_malloc, 87 | [ 88 | LIBS="$LIBS -lfftw3" 89 | FFT_WRAPPER="fftlibw3_op.cpp" 90 | AM_CONDITIONAL(FFTW3, true) 91 | AM_CONDITIONAL(VDSP, false) 92 | AC_DEFINE_UNQUOTED(FFTW3, 1, Use libfftw3) 93 | ], [ 94 | echo "*" 95 | echo "* libfft3 is needed to build this library." 96 | echo "*" 97 | AC_MSG_ERROR("Cannot build. Stop.")]) 98 | fi 99 | 100 | AC_SUBST(FFT_WRAPPER) 101 | 102 | dnl Checks for header files. 103 | 104 | dnl Checks for typedefs, structures, and compiler characteristics. 105 | AC_SUBST(CFLAGS) 106 | AC_OUTPUT([ 107 | Makefile 108 | include/Makefile 109 | include/ofa1/Makefile 110 | lib/Makefile 111 | lib/JAMA/Makefile 112 | lib/AFLIB/Makefile 113 | examples/Makefile 114 | libofa.pc], 115 | echo timestamp > stamp-h) 116 | -------------------------------------------------------------------------------- /examples/COPYING: -------------------------------------------------------------------------------- 1 | Public Domain (PD) 2006 MusicIP Corporation 2 | No rights reserved. 3 | No rights wronged. Ever. 4 | 5 | The source code to the examples for libofa have been placed into the 6 | Public Domain. See the dedication below for details: 7 | 8 | ---------------------------------------------------------------- 9 | 10 | Copyright-Only Dedication 11 | (based on United States law) 12 | or 13 | Public Domain Certification 14 | 15 | The person or persons who have associated work with this document 16 | (the "Dedicator" or "Certifier") hereby either (a) certifies that, 17 | to the best of his knowledge, the work of authorship identified is 18 | in the public domain of the country from which the work is published, 19 | or (b) hereby dedicates whatever copyright the dedicators holds in 20 | the work of authorship identified below (the "Work") to the public 21 | domain. A certifier, moreover, dedicates any copyright interest he 22 | may have in the associated work, and for these purposes, is 23 | described as a "dedicator" below. 24 | 25 | A certifier has taken reasonable steps to verify the copyright 26 | status of this work. Certifier recognizes that his good faith 27 | efforts may not shield him from liability if in fact the work 28 | certified is not in the public domain. 29 | 30 | Dedicator makes this dedication for the benefit of the public at 31 | large and to the detriment of the Dedicator's heirs and 32 | successors. Dedicator intends this dedication to be an overt 33 | act of relinquishment in perpetuity of all present and future 34 | rights under copyright law, whether vested or contingent, in the 35 | Work. Dedicator understands that such relinquishment of all 36 | rights includes the relinquishment of all rights to enforce 37 | (by lawsuit or otherwise) those copyrights in the Work. 38 | 39 | Dedicator recognizes that, once placed in the public domain, the 40 | Work may be freely reproduced, distributed, transmitted, used, 41 | modified, built upon, or otherwise exploited by anyone for 42 | any purpose, commercial or non-commercial, and in any way, 43 | including by methods that have not yet been invented or conceived. 44 | -------------------------------------------------------------------------------- /examples/Makefile.am: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------ 2 | # 3 | # libofa -- the Open Fingerprint Architecture library 4 | # 5 | # Copyright (C) 2006 MusicIP Corporation 6 | # All rights reserved. 7 | # 8 | #------------------------------------------------------------------- 9 | INCLUDES = -I$(top_srcdir)/include 10 | 11 | noinst_PROGRAMS = example 12 | 13 | example_SOURCES = example.cpp protocol.cpp uselame.cpp wavefile.cpp protocol.h 14 | example_LDADD = @CURL_LIBS@ @EXPAT_LIBS@ $(top_builddir)/lib/libofa.la 15 | -------------------------------------------------------------------------------- /examples/Makefile.in: -------------------------------------------------------------------------------- 1 | # Makefile.in generated by automake 1.8.5 from Makefile.am. 2 | # @configure_input@ 3 | 4 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 5 | # 2003, 2004 Free Software Foundation, Inc. 6 | # This Makefile.in is free software; the Free Software Foundation 7 | # gives unlimited permission to copy and/or distribute it, 8 | # with or without modifications, as long as this notice is preserved. 9 | 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 12 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 13 | # PARTICULAR PURPOSE. 14 | 15 | @SET_MAKE@ 16 | 17 | SOURCES = $(example_SOURCES) 18 | 19 | srcdir = @srcdir@ 20 | top_srcdir = @top_srcdir@ 21 | VPATH = @srcdir@ 22 | pkgdatadir = $(datadir)/@PACKAGE@ 23 | pkglibdir = $(libdir)/@PACKAGE@ 24 | pkgincludedir = $(includedir)/@PACKAGE@ 25 | top_builddir = .. 26 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 27 | INSTALL = @INSTALL@ 28 | install_sh_DATA = $(install_sh) -c -m 644 29 | install_sh_PROGRAM = $(install_sh) -c 30 | install_sh_SCRIPT = $(install_sh) -c 31 | INSTALL_HEADER = $(INSTALL_DATA) 32 | transform = $(program_transform_name) 33 | NORMAL_INSTALL = : 34 | PRE_INSTALL = : 35 | POST_INSTALL = : 36 | NORMAL_UNINSTALL = : 37 | PRE_UNINSTALL = : 38 | POST_UNINSTALL = : 39 | host_triplet = @host@ 40 | noinst_PROGRAMS = example$(EXEEXT) 41 | subdir = examples 42 | DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in COPYING 43 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 44 | am__aclocal_m4_deps = $(top_srcdir)/configure.in 45 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 46 | $(ACLOCAL_M4) 47 | mkinstalldirs = $(mkdir_p) 48 | CONFIG_HEADER = $(top_builddir)/config.h 49 | CONFIG_CLEAN_FILES = 50 | PROGRAMS = $(noinst_PROGRAMS) 51 | am_example_OBJECTS = example.$(OBJEXT) protocol.$(OBJEXT) \ 52 | uselame.$(OBJEXT) wavefile.$(OBJEXT) 53 | example_OBJECTS = $(am_example_OBJECTS) 54 | example_DEPENDENCIES = $(top_builddir)/lib/libofa.la 55 | DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) 56 | depcomp = $(SHELL) $(top_srcdir)/depcomp 57 | am__depfiles_maybe = depfiles 58 | @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/example.Po ./$(DEPDIR)/protocol.Po \ 59 | @AMDEP_TRUE@ ./$(DEPDIR)/uselame.Po ./$(DEPDIR)/wavefile.Po 60 | CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ 61 | $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) 62 | LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ 63 | $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ 64 | $(AM_CXXFLAGS) $(CXXFLAGS) 65 | CXXLD = $(CXX) 66 | CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ 67 | $(AM_LDFLAGS) $(LDFLAGS) -o $@ 68 | COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ 69 | $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) 70 | LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ 71 | $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ 72 | $(AM_CFLAGS) $(CFLAGS) 73 | CCLD = $(CC) 74 | LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ 75 | $(AM_LDFLAGS) $(LDFLAGS) -o $@ 76 | SOURCES = $(example_SOURCES) 77 | DIST_SOURCES = $(example_SOURCES) 78 | ETAGS = etags 79 | CTAGS = ctags 80 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 81 | ACLOCAL = @ACLOCAL@ 82 | AMDEP_FALSE = @AMDEP_FALSE@ 83 | AMDEP_TRUE = @AMDEP_TRUE@ 84 | AMTAR = @AMTAR@ 85 | AR = @AR@ 86 | AUTOCONF = @AUTOCONF@ 87 | AUTOHEADER = @AUTOHEADER@ 88 | AUTOMAKE = @AUTOMAKE@ 89 | AWK = @AWK@ 90 | CC = @CC@ 91 | CCDEPMODE = @CCDEPMODE@ 92 | CFLAGS = @CFLAGS@ 93 | CPP = @CPP@ 94 | CPPFLAGS = @CPPFLAGS@ 95 | CURL_LIBS = @CURL_LIBS@ 96 | CXX = @CXX@ 97 | CXXCPP = @CXXCPP@ 98 | CXXDEPMODE = @CXXDEPMODE@ 99 | CXXFLAGS = @CXXFLAGS@ 100 | CYGPATH_W = @CYGPATH_W@ 101 | DARWIN_FALSE = @DARWIN_FALSE@ 102 | DARWIN_TRUE = @DARWIN_TRUE@ 103 | DEFS = @DEFS@ 104 | DEPDIR = @DEPDIR@ 105 | ECHO = @ECHO@ 106 | ECHO_C = @ECHO_C@ 107 | ECHO_N = @ECHO_N@ 108 | ECHO_T = @ECHO_T@ 109 | EGREP = @EGREP@ 110 | EXEEXT = @EXEEXT@ 111 | EXPAT_LIBS = @EXPAT_LIBS@ 112 | F77 = @F77@ 113 | FFLAGS = @FFLAGS@ 114 | FFTW3_FALSE = @FFTW3_FALSE@ 115 | FFTW3_TRUE = @FFTW3_TRUE@ 116 | FFT_WRAPPER = @FFT_WRAPPER@ 117 | FREEBSD_FALSE = @FREEBSD_FALSE@ 118 | FREEBSD_TRUE = @FREEBSD_TRUE@ 119 | INSTALL_DATA = @INSTALL_DATA@ 120 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ 121 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ 122 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 123 | LDFLAGS = @LDFLAGS@ 124 | LIBOBJS = @LIBOBJS@ 125 | LIBS = @LIBS@ 126 | LIBTOOL = @LIBTOOL@ 127 | LIBTOOL_DEPS = @LIBTOOL_DEPS@ 128 | LN_S = @LN_S@ 129 | LTLIBOBJS = @LTLIBOBJS@ 130 | MAINT = @MAINT@ 131 | MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ 132 | MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ 133 | MAKEINFO = @MAKEINFO@ 134 | OBJEXT = @OBJEXT@ 135 | PACKAGE = @PACKAGE@ 136 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ 137 | PACKAGE_NAME = @PACKAGE_NAME@ 138 | PACKAGE_STRING = @PACKAGE_STRING@ 139 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ 140 | PACKAGE_VERSION = @PACKAGE_VERSION@ 141 | PATH_SEPARATOR = @PATH_SEPARATOR@ 142 | PREFIX = @PREFIX@ 143 | RANLIB = @RANLIB@ 144 | SET_MAKE = @SET_MAKE@ 145 | SHELL = @SHELL@ 146 | STRIP = @STRIP@ 147 | VDSP_FALSE = @VDSP_FALSE@ 148 | VDSP_TRUE = @VDSP_TRUE@ 149 | VERSION = @VERSION@ 150 | ac_ct_AR = @ac_ct_AR@ 151 | ac_ct_CC = @ac_ct_CC@ 152 | ac_ct_CXX = @ac_ct_CXX@ 153 | ac_ct_F77 = @ac_ct_F77@ 154 | ac_ct_RANLIB = @ac_ct_RANLIB@ 155 | ac_ct_STRIP = @ac_ct_STRIP@ 156 | am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ 157 | am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ 158 | am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ 159 | am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 160 | am__include = @am__include@ 161 | am__leading_dot = @am__leading_dot@ 162 | am__quote = @am__quote@ 163 | bindir = @bindir@ 164 | build = @build@ 165 | build_alias = @build_alias@ 166 | build_cpu = @build_cpu@ 167 | build_os = @build_os@ 168 | build_vendor = @build_vendor@ 169 | datadir = @datadir@ 170 | exec_prefix = @exec_prefix@ 171 | host = @host@ 172 | host_alias = @host_alias@ 173 | host_cpu = @host_cpu@ 174 | host_os = @host_os@ 175 | host_vendor = @host_vendor@ 176 | includedir = @includedir@ 177 | infodir = @infodir@ 178 | install_sh = @install_sh@ 179 | libdir = @libdir@ 180 | libexecdir = @libexecdir@ 181 | localstatedir = @localstatedir@ 182 | mandir = @mandir@ 183 | mkdir_p = @mkdir_p@ 184 | oldincludedir = @oldincludedir@ 185 | prefix = @prefix@ 186 | program_transform_name = @program_transform_name@ 187 | sbindir = @sbindir@ 188 | sharedstatedir = @sharedstatedir@ 189 | sysconfdir = @sysconfdir@ 190 | target_alias = @target_alias@ 191 | 192 | # ------------------------------------------------------------------ 193 | # 194 | # libofa -- the Open Fingerprint Architecture library 195 | # 196 | # Copyright (C) 2006 MusicIP Corporation 197 | # All rights reserved. 198 | # 199 | #------------------------------------------------------------------- 200 | INCLUDES = -I$(top_srcdir)/include 201 | example_SOURCES = example.cpp protocol.cpp uselame.cpp wavefile.cpp protocol.h 202 | example_LDADD = @CURL_LIBS@ @EXPAT_LIBS@ $(top_builddir)/lib/libofa.la 203 | all: all-am 204 | 205 | .SUFFIXES: 206 | .SUFFIXES: .cpp .lo .o .obj 207 | $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) 208 | @for dep in $?; do \ 209 | case '$(am__configure_deps)' in \ 210 | *$$dep*) \ 211 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ 212 | && exit 0; \ 213 | exit 1;; \ 214 | esac; \ 215 | done; \ 216 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/Makefile'; \ 217 | cd $(top_srcdir) && \ 218 | $(AUTOMAKE) --gnu examples/Makefile 219 | .PRECIOUS: Makefile 220 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 221 | @case '$?' in \ 222 | *config.status*) \ 223 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ 224 | *) \ 225 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ 226 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 227 | esac; 228 | 229 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) 230 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 231 | 232 | $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) 233 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 234 | $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) 235 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 236 | 237 | clean-noinstPROGRAMS: 238 | @list='$(noinst_PROGRAMS)'; for p in $$list; do \ 239 | f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ 240 | echo " rm -f $$p $$f"; \ 241 | rm -f $$p $$f ; \ 242 | done 243 | example$(EXEEXT): $(example_OBJECTS) $(example_DEPENDENCIES) 244 | @rm -f example$(EXEEXT) 245 | $(CXXLINK) $(example_LDFLAGS) $(example_OBJECTS) $(example_LDADD) $(LIBS) 246 | 247 | mostlyclean-compile: 248 | -rm -f *.$(OBJEXT) 249 | 250 | distclean-compile: 251 | -rm -f *.tab.c 252 | 253 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example.Po@am__quote@ 254 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protocol.Po@am__quote@ 255 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uselame.Po@am__quote@ 256 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wavefile.Po@am__quote@ 257 | 258 | .cpp.o: 259 | @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ 260 | @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi 261 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ 262 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ 263 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 264 | @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< 265 | 266 | .cpp.obj: 267 | @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ 268 | @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi 269 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ 270 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ 271 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 272 | @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` 273 | 274 | .cpp.lo: 275 | @am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ 276 | @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi 277 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ 278 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ 279 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 280 | @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< 281 | 282 | mostlyclean-libtool: 283 | -rm -f *.lo 284 | 285 | clean-libtool: 286 | -rm -rf .libs _libs 287 | 288 | distclean-libtool: 289 | -rm -f libtool 290 | uninstall-info-am: 291 | 292 | ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) 293 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 294 | unique=`for i in $$list; do \ 295 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 296 | done | \ 297 | $(AWK) ' { files[$$0] = 1; } \ 298 | END { for (i in files) print i; }'`; \ 299 | mkid -fID $$unique 300 | tags: TAGS 301 | 302 | TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ 303 | $(TAGS_FILES) $(LISP) 304 | tags=; \ 305 | here=`pwd`; \ 306 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 307 | unique=`for i in $$list; do \ 308 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 309 | done | \ 310 | $(AWK) ' { files[$$0] = 1; } \ 311 | END { for (i in files) print i; }'`; \ 312 | if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ 313 | test -n "$$unique" || unique=$$empty_fix; \ 314 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 315 | $$tags $$unique; \ 316 | fi 317 | ctags: CTAGS 318 | CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ 319 | $(TAGS_FILES) $(LISP) 320 | tags=; \ 321 | here=`pwd`; \ 322 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 323 | unique=`for i in $$list; do \ 324 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 325 | done | \ 326 | $(AWK) ' { files[$$0] = 1; } \ 327 | END { for (i in files) print i; }'`; \ 328 | test -z "$(CTAGS_ARGS)$$tags$$unique" \ 329 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ 330 | $$tags $$unique 331 | 332 | GTAGS: 333 | here=`$(am__cd) $(top_builddir) && pwd` \ 334 | && cd $(top_srcdir) \ 335 | && gtags -i $(GTAGS_ARGS) $$here 336 | 337 | distclean-tags: 338 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags 339 | 340 | distdir: $(DISTFILES) 341 | @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ 342 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ 343 | list='$(DISTFILES)'; for file in $$list; do \ 344 | case $$file in \ 345 | $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ 346 | $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ 347 | esac; \ 348 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ 349 | dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ 350 | if test "$$dir" != "$$file" && test "$$dir" != "."; then \ 351 | dir="/$$dir"; \ 352 | $(mkdir_p) "$(distdir)$$dir"; \ 353 | else \ 354 | dir=''; \ 355 | fi; \ 356 | if test -d $$d/$$file; then \ 357 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ 358 | cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ 359 | fi; \ 360 | cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ 361 | else \ 362 | test -f $(distdir)/$$file \ 363 | || cp -p $$d/$$file $(distdir)/$$file \ 364 | || exit 1; \ 365 | fi; \ 366 | done 367 | check-am: all-am 368 | check: check-am 369 | all-am: Makefile $(PROGRAMS) 370 | installdirs: 371 | install: install-am 372 | install-exec: install-exec-am 373 | install-data: install-data-am 374 | uninstall: uninstall-am 375 | 376 | install-am: all-am 377 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am 378 | 379 | installcheck: installcheck-am 380 | install-strip: 381 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 382 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ 383 | `test -z '$(STRIP)' || \ 384 | echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install 385 | mostlyclean-generic: 386 | 387 | clean-generic: 388 | 389 | distclean-generic: 390 | -rm -f $(CONFIG_CLEAN_FILES) 391 | 392 | maintainer-clean-generic: 393 | @echo "This command is intended for maintainers to use" 394 | @echo "it deletes files that may require special tools to rebuild." 395 | clean: clean-am 396 | 397 | clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ 398 | mostlyclean-am 399 | 400 | distclean: distclean-am 401 | -rm -rf ./$(DEPDIR) 402 | -rm -f Makefile 403 | distclean-am: clean-am distclean-compile distclean-generic \ 404 | distclean-libtool distclean-tags 405 | 406 | dvi: dvi-am 407 | 408 | dvi-am: 409 | 410 | html: html-am 411 | 412 | info: info-am 413 | 414 | info-am: 415 | 416 | install-data-am: 417 | 418 | install-exec-am: 419 | 420 | install-info: install-info-am 421 | 422 | install-man: 423 | 424 | installcheck-am: 425 | 426 | maintainer-clean: maintainer-clean-am 427 | -rm -rf ./$(DEPDIR) 428 | -rm -f Makefile 429 | maintainer-clean-am: distclean-am maintainer-clean-generic 430 | 431 | mostlyclean: mostlyclean-am 432 | 433 | mostlyclean-am: mostlyclean-compile mostlyclean-generic \ 434 | mostlyclean-libtool 435 | 436 | pdf: pdf-am 437 | 438 | pdf-am: 439 | 440 | ps: ps-am 441 | 442 | ps-am: 443 | 444 | uninstall-am: uninstall-info-am 445 | 446 | .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ 447 | clean-libtool clean-noinstPROGRAMS ctags distclean \ 448 | distclean-compile distclean-generic distclean-libtool \ 449 | distclean-tags distdir dvi dvi-am html html-am info info-am \ 450 | install install-am install-data install-data-am install-exec \ 451 | install-exec-am install-info install-info-am install-man \ 452 | install-strip installcheck installcheck-am installdirs \ 453 | maintainer-clean maintainer-clean-generic mostlyclean \ 454 | mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ 455 | pdf pdf-am ps ps-am tags uninstall uninstall-am \ 456 | uninstall-info-am 457 | 458 | # Tell versions [3.59,3.63) of GNU make to not export all variables. 459 | # Otherwise a system limit (for SysV at least) may be exceeded. 460 | .NOEXPORT: 461 | -------------------------------------------------------------------------------- /examples/example.cpp: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | 3 | libofa -- the Open Fingerprint Architecture library 4 | 5 | Public Domain (PD) 2006 MusicIP Corporation 6 | No rights reserved. 7 | 8 | -------------------------------------------------------------------*/ 9 | 10 | #include "protocol.h" 11 | 12 | AudioData* loadWaveFile(char *file); 13 | AudioData* loadDataUsingLAME(char *file); 14 | 15 | int main(int argc, char **argv) { 16 | AudioData *data = 0; 17 | 18 | // Go through each filename passed on the command line 19 | for (int i = 1; i < argc; ++i) { 20 | char *file = argv[i]; 21 | 22 | // Get the extension 23 | char fext[100] = ""; 24 | char *p = strrchr(file, '.'); 25 | if ( p != NULL ) { 26 | strcpy(fext, p+1); 27 | 28 | // Lowercase the extension 29 | p = fext; 30 | while ( *p ) { 31 | *p = tolower(*p); 32 | p++; 33 | } 34 | } 35 | 36 | if ( strstr(fext, "wav") ) { 37 | // Process a Wave file 38 | printf("Checking file %s\n", file); 39 | data = loadWaveFile(file); 40 | } else { 41 | // Handle anything else 42 | printf("Decoding file %s\n", file); 43 | data = loadDataUsingLAME(file); 44 | } 45 | if (!data) { 46 | printf("** Failed to load file\n"); 47 | continue; 48 | } 49 | 50 | // Get the fingerprint 51 | if (!data->createPrint()) { 52 | printf("** Failed to generate print.\n"); 53 | delete data; 54 | continue; 55 | } 56 | 57 | // Get the metadata. Make sure to get your own client id 58 | // at http://www.musicdns.org before using this in your own application. 59 | TrackInformation *info = data->getMetadata("a7f6063296c0f1c9b75c7f511861b89b", "Example 0.9.3", true); 60 | if (!info) { 61 | printf("** Failed to get metadata.\n"); 62 | } else { 63 | // Print results. 64 | printf(" Title: %s\n", info->getTrack().c_str()); 65 | printf("Artist: %s\n", info->getArtist().c_str()); 66 | printf(" PUID: %s\n", info->getPUID().c_str()); 67 | } 68 | delete data; 69 | } 70 | return 0; 71 | } 72 | 73 | -------------------------------------------------------------------------------- /examples/protocol.cpp: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | 3 | libofa -- the Open Fingerprint Architecture library 4 | 5 | Public Domain (PD) 2006 MusicIP Corporation 6 | No rights reserved. 7 | 8 | -------------------------------------------------------------------*/ 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | using namespace std; 18 | 19 | #include "protocol.h" 20 | 21 | const char *url = "http://ofa.musicdns.org/ofa/1/track"; 22 | const char *userAgent = "libofa_example"; 23 | const char *unknown = "unknown"; 24 | 25 | // Lookup by fingerprint 26 | const char *request_format = 27 | "cid=%s&" // Client ID 28 | "cvr=%s&" // Client Version 29 | "fpt=%s&" // Fingerprint 30 | "rmd=%d&" // m = 1: return metadata; m = 0: only return id 31 | "brt=%d&" // bitrate (kbps) 32 | "fmt=%s&" // File extension (e.g. mp3, ogg, flac) 33 | "dur=%ld&" // Length of track (milliseconds) 34 | "art=%s&" // Artist name. If there is none, send "unknown" 35 | "ttl=%s&" // Track title. If there is none, send "unknown" 36 | "alb=%s&" // Album name. If there is none, send "unknown" 37 | "tnm=%d&" // Track number in album. If there is none, send "0" 38 | "gnr=%s&" // Genre. If there is none, send "unknown" 39 | "yrr=%s&" // Year. If there is none, send "0" 40 | "enc=%s&" // Encoding. e = true: ISO-8859-15; e = false: UTF-8 (default). Optional. 41 | "\r\n"; 42 | 43 | // Lookup by PUID (Most fields drop out) 44 | const char *request_format2 = 45 | "cid=%s&" // Client ID 46 | "cvr=%s&" // Client Version 47 | "pid=%s&" // PUID 48 | "rmd=%d&" // m = 1: return metadata; m = 0: only return id 49 | "brt=%d&" // bitrate (kbps) 50 | "fmt=%s&" // File extension (e.g. mp3, ogg, flac) 51 | "dur=%ld&" // Length of track (milliseconds) 52 | "art=%s&" // Artist name. If there is none, send "unknown" 53 | "ttl=%s&" // Track title. If there is none, send "unknown" 54 | "alb=%s&" // Album name. If there is none, send "unknown" 55 | "tnm=%d&" // Track number in album. If there is none, send "0" 56 | "gnr=%s&" // Genre. If there is none, send "unknown" 57 | "yrr=%s&" // Year. If there is none, send "0" 58 | "enc=%s&" // Encoding. e = true: ISO-8859-15; e = false: UTF-8 (default). Optional. 59 | "\r\n"; 60 | 61 | 62 | // -------------------------------------------------------------------- 63 | // HTTP POST support using standard curl calls 64 | // -------------------------------------------------------------------- 65 | size_t data_callback(void *ptr, size_t size, size_t num, void *arg) 66 | { 67 | string *str = (string *)arg; 68 | (*str) += string((const char *)ptr, size * num); 69 | return size * num; 70 | } 71 | 72 | long http_post(const string &url, const string &userAgent, const string &postData, string &doc) 73 | { 74 | CURL *curl; 75 | long ret = 0; 76 | struct curl_slist *headerlist=NULL; 77 | 78 | headerlist = curl_slist_append(headerlist, "Expect:"); 79 | 80 | curl_global_init(CURL_GLOBAL_ALL); 81 | curl = curl_easy_init(); 82 | curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); 83 | curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&doc); 84 | curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, data_callback); 85 | curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist); 86 | curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, postData.length()); 87 | curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postData.c_str()); 88 | curl_easy_setopt(curl, CURLOPT_POST, 1); 89 | curl_easy_setopt(curl, CURLOPT_USERAGENT, userAgent.c_str()); 90 | curl_easy_perform(curl); 91 | curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &ret); 92 | curl_easy_cleanup(curl); 93 | 94 | curl_slist_free_all (headerlist); 95 | 96 | return ret; 97 | } 98 | 99 | // -------------------------------------------------------------------- 100 | // XML Parsing support 101 | // -------------------------------------------------------------------- 102 | 103 | struct ParseInfo 104 | { 105 | string path; 106 | string pcdata; 107 | TrackInformation *info; 108 | }; 109 | 110 | void begin_element(void *data, const XML_Char *el, const XML_Char **attr) 111 | { 112 | map attrs; 113 | 114 | for(; *attr;) { 115 | string key = string((char *)*(attr++)); 116 | string value = string((char *)*(attr++)); 117 | attrs[key] = value; 118 | } 119 | 120 | ((ParseInfo *)data)->path += string("/") + string(el); 121 | if (((ParseInfo *)data)->path == "/metadata/track/puid-list/puid") 122 | ((ParseInfo *)data)->info->setPUID(attrs["id"]); 123 | 124 | ((ParseInfo *)data)->pcdata = ""; 125 | } 126 | 127 | void end_element(void *data, const XML_Char *el) 128 | { 129 | string::size_type pos; 130 | 131 | if (((ParseInfo *)data)->path == "/metadata/track/title") 132 | ((ParseInfo *)data)->info->setTrack(((ParseInfo *)data)->pcdata); 133 | if (((ParseInfo *)data)->path == "/metadata/track/artist/name") 134 | ((ParseInfo *)data)->info->setArtist(((ParseInfo *)data)->pcdata); 135 | 136 | pos = ((ParseInfo *)data)->path.rfind("/"); 137 | if (pos != string::npos) 138 | ((ParseInfo *)data)->path = ((ParseInfo *)data)->path.substr(0, pos); 139 | } 140 | 141 | void pc_data(void *data, const XML_Char *charData, int len) 142 | { 143 | char *temp; 144 | 145 | temp = new char[len + 1]; 146 | strncpy(temp, (char *)charData, len); 147 | temp[len] = 0; 148 | ((ParseInfo *)data)->pcdata += string(temp); 149 | delete temp; 150 | } 151 | 152 | bool parse_xml(const string &doc, TrackInformation *info, string &err) 153 | { 154 | ParseInfo pinfo; 155 | 156 | err = ""; 157 | pinfo.info = info; 158 | XML_Parser parser = XML_ParserCreate(NULL); 159 | XML_SetUserData(parser, (void *)&pinfo); 160 | XML_SetElementHandler(parser, ::begin_element, ::end_element); 161 | XML_SetCharacterDataHandler(parser, ::pc_data); 162 | int ret = XML_Parse(parser, doc.c_str(), doc.length(), 1); 163 | 164 | if (ret) 165 | { 166 | XML_ParserFree(parser); 167 | return true; 168 | } 169 | 170 | err = string(XML_ErrorString(XML_GetErrorCode(parser))); 171 | char num[10]; 172 | sprintf(num, "%d", XML_GetCurrentLineNumber(parser)); 173 | err += string(" on line ") + string(num); 174 | XML_ParserFree(parser); 175 | 176 | return false; 177 | } 178 | 179 | // -------------------------------------------------------------------- 180 | // Retrieve metadata for fingerprint 181 | // -------------------------------------------------------------------- 182 | 183 | // Returns true on success 184 | bool retrieve_metadata(string client_key, string client_version, 185 | TrackInformation *info, bool getMetadata) 186 | { 187 | if (!info) 188 | return false; 189 | 190 | // All metadata fields must be provided before this call if the 191 | // information is available, as part of the Terms of Service. 192 | // This helps create a better database for all users of the system. 193 | // 194 | // If the fields are not available, you can use default values. 195 | // Here we check for fields which have no default values. 196 | if (client_key.length() == 0) 197 | return false; 198 | if (client_version.length() == 0) 199 | return false; 200 | 201 | bool lookupByPrint = false; 202 | if (info->getPUID().length() == 0) { 203 | // Lookup by fingerprint 204 | if (info->getPrint().length() == 0) 205 | return false; 206 | if (info->getFormat().length() == 0) 207 | return false; 208 | if (info->getLengthInMS() == 0) 209 | return false; 210 | 211 | lookupByPrint = true; 212 | } 213 | 214 | // Sloppily estimate the size of the resultant URL. Err on the side of making the string too big. 215 | int bufSize = strlen(lookupByPrint ? request_format : request_format2) + 216 | client_key.length() + client_version.length() + 217 | (lookupByPrint ? info->getPrint().length() : info->getPUID().length()) + 218 | 16 + // getMetadata ? 1 : 0, 219 | 16 + // info->getBitrate(), 220 | 16 + //info->getFormat().c_str(), 221 | 16 + //info->getLengthInMS(), 222 | ((info->getArtist().c_str() == 0) ? strlen(unknown) : info->getArtist().length()) + 223 | ((info->getTrack().c_str() == 0) ? strlen(unknown) : info->getTrack().length()) + 224 | ((info->getAlbum().c_str() == 0) ? strlen(unknown) : info->getAlbum().length()) + 225 | 16 + // info->getTrackNum() + 226 | ((info->getGenre().c_str() == 0) ? strlen(unknown) : info->getGenre().length()) + 227 | ((info->getYear().c_str() == 0) ? 1 : info->getYear().length()) + 228 | info->getEncoding().length(); 229 | 230 | char *buf = new char[bufSize]; 231 | sprintf(buf, lookupByPrint ? request_format : request_format2, 232 | client_key.c_str(), 233 | client_version.c_str(), 234 | lookupByPrint ? info->getPrint().c_str() : info->getPUID().c_str(), 235 | getMetadata ? 1 : 0, 236 | info->getBitrate(), 237 | info->getFormat().c_str(), 238 | info->getLengthInMS(), 239 | (info->getArtist().length() == 0) ? unknown : info->getArtist().c_str(), 240 | (info->getTrack().length() == 0) ? unknown : info->getTrack().c_str(), 241 | (info->getAlbum().length() == 0) ? unknown : info->getAlbum().c_str(), 242 | info->getTrackNum(), 243 | (info->getGenre().length() == 0) ? unknown : info->getGenre().c_str(), 244 | (info->getYear().length() == 0) ? "0" : info->getYear().c_str(), 245 | info->getEncoding().c_str()); 246 | 247 | string response; 248 | // printf("request: '%s'\n", buf); 249 | long ret = http_post(url, userAgent, buf, response); 250 | delete [] buf; 251 | 252 | if (ret != 200) 253 | { 254 | // printf("Error: %ld\n", ret); 255 | // printf("response: %s\n\n", response.c_str()); 256 | return false; 257 | } 258 | // printf("response: %s\n\n", response.c_str()); 259 | 260 | unsigned int q = response.find("setTrack(""); 268 | 269 | // Clears artists if it wasn't returned 270 | info->setArtist(""); 271 | } 272 | return true; 273 | } 274 | -------------------------------------------------------------------------------- /examples/protocol.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | 3 | libofa -- the Open Fingerprint Architecture library 4 | 5 | Public Domain (PD) 2006 MusicIP Corporation 6 | No rights reserved. 7 | 8 | -------------------------------------------------------------------*/ 9 | #ifndef __PROTOCOL_H__ 10 | #define __PROTOCOL_H__ 11 | 12 | #include 13 | #include "ofa1/ofa.h" 14 | 15 | using namespace std; 16 | 17 | // This object must be filled out completely prior to making any 18 | // calls to the server. On return, some fields will be filled out. 19 | class TrackInformation { 20 | private: 21 | string puid; 22 | string print; 23 | string encoding; // All other strings must honor this encoding 24 | int bitrate; // i.e. "192kbps", use 0 for VBR or freeformat 25 | string format; // File extension 26 | long length_in_ms; // In milliseconds 27 | string artist; 28 | string track; 29 | string album; 30 | int trackNum; // use 0 if not known 31 | string genre; 32 | string year; 33 | public: 34 | TrackInformation() : 35 | bitrate(0), length_in_ms(0), trackNum(0) {} 36 | ~TrackInformation() {} 37 | void setPrint(string p) { print = p; } 38 | string getPrint() const { return print; } 39 | // Only supported encodings are UTF-8 (default) and ISO-8859-15 40 | void setEncoding(string e) { encoding = e; } 41 | string getEncoding() const { return encoding; } 42 | void setBitrate(int b) { bitrate = b; } 43 | int getBitrate() const { return bitrate; } 44 | void setFormat(string fmt) { format = fmt; } 45 | string getFormat() const { return format; } 46 | void setLengthInMS(long ms) { length_in_ms = ms; } 47 | long getLengthInMS() const { return length_in_ms; } 48 | void setArtist(string name) { artist = name; } 49 | string getArtist() const { return artist; } 50 | void setTrack(string name) { track = name; } 51 | string getTrack() const { return track; } 52 | void setAlbum(string name) { album = name; } 53 | string getAlbum() const { return album; } 54 | void setTrackNum(int t) { trackNum = t; } 55 | int getTrackNum() const { return trackNum; } 56 | void setGenre(string g) { genre = g; } 57 | string getGenre() const { return genre; } 58 | void setYear(string y) { year = y; } 59 | string getYear() const { return year; } 60 | void setPUID(string id) { puid = id; } 61 | string getPUID() const { return puid; } 62 | }; 63 | 64 | // Get your unique key at http://www.musicdns.org 65 | bool retrieve_metadata(string client_key, string client_verstion, 66 | TrackInformation *info, bool getMetadata); 67 | 68 | class AudioData { 69 | private: 70 | unsigned char *samples; 71 | int byteOrder; 72 | long size; 73 | int sRate; 74 | bool stereo; 75 | public: 76 | TrackInformation info; 77 | AudioData() : samples(0), size(0), sRate(0), stereo(false) {} 78 | ~AudioData() { 79 | delete[] samples; 80 | } 81 | // size is number of samples (half the number of bytes) 82 | void setData(unsigned char*_samples, int _byteOrder, long _size, 83 | int _sRate, bool _stereo, int _ms, string _fmt) { 84 | samples = _samples; 85 | byteOrder = _byteOrder; 86 | size = _size; 87 | sRate = _sRate; 88 | stereo = _stereo; 89 | // These two fields are used later for the protocol layer 90 | info.setLengthInMS(_ms); 91 | info.setFormat(_fmt); 92 | } 93 | int getByteOrder() const { return byteOrder; } 94 | long getSize() const { return size; } 95 | int getSRate() const { return sRate; } 96 | bool getStereo() const { return stereo; } 97 | bool createPrint() { 98 | const char *print = ofa_create_print(samples, byteOrder, size, sRate, stereo); 99 | if (!print) 100 | return false; 101 | info.setPrint(print); 102 | return true; 103 | } 104 | // Get your unique key at http://www.musicdns.org 105 | TrackInformation *getMetadata(string client_key, string client_version, 106 | bool metadataFlag) 107 | { 108 | if (!retrieve_metadata(client_key, client_version, &info, metadataFlag)) 109 | return 0; 110 | return &info; 111 | } 112 | }; 113 | 114 | #endif 115 | -------------------------------------------------------------------------------- /examples/uselame.cpp: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | 3 | libofa -- the Open Fingerprint Architecture library 4 | 5 | Public Domain (PD) 2006 MusicIP Corporation 6 | No rights reserved. 7 | 8 | -------------------------------------------------------------------*/ 9 | #include "protocol.h" 10 | #ifdef WIN32 11 | #include "windows.h" 12 | #else 13 | #include 14 | #endif 15 | 16 | AudioData *loadWaveFile(char *file); 17 | 18 | // loadDataUsingLAME 19 | // 20 | // Opens an audio file and converts it to a temp .wav file 21 | // Calls loadWaveFile to load the data 22 | // 23 | AudioData* loadDataUsingLAME(char *file) { 24 | char *temp = "fpTemp.wav"; 25 | 26 | #ifdef WIN32 27 | STARTUPINFO si; 28 | PROCESS_INFORMATION pi; 29 | 30 | ZeroMemory(&si, sizeof(si)); 31 | si.cb = sizeof(si); 32 | ZeroMemory(&pi, sizeof(pi)); 33 | 34 | char * cmd = new char[1024]; 35 | sprintf(cmd,"lame --decode \"%s\" fpTemp.wav", file); 36 | if (!CreateProcess(NULL, // No module name (use command line). 37 | cmd, // Command line. 38 | NULL, // Process handle not inheritable. 39 | NULL, // Thread handle not inheritable. 40 | FALSE, // Set handle inheritance to FALSE. 41 | DETACHED_PROCESS, // Creation flags. 42 | NULL, // Use parent's environment block. 43 | NULL, // Use parent's starting directory. 44 | &si, // Pointer to STARTUPINFO structure. 45 | &pi ) // Pointer to PROCESS_INFORMATION structure. 46 | ) 47 | { 48 | return 0; 49 | } 50 | delete[] cmd; 51 | 52 | DWORD result = WaitForSingleObject(pi.hProcess, 1000000 /*INFINITE*/); 53 | #else 54 | pid_t pid = fork(); 55 | char * flag = "--decode"; 56 | char * cmd = "lame"; // lame path 57 | char * argv[4] = {cmd, flag, file, temp}; 58 | if (execv(cmd, (char **) argv) == -1) { 59 | return 0; 60 | } 61 | int exitCode = -1; 62 | pid = waitpid(pid, &exitCode, 0); // NYI: Implement timeout 63 | if (exitCode != 0) { 64 | return 0; 65 | } 66 | #endif 67 | AudioData *data = loadWaveFile(temp); 68 | unlink(temp); 69 | return data; 70 | } 71 | 72 | -------------------------------------------------------------------------------- /examples/wavefile.cpp: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | 3 | libofa -- the Open Fingerprint Architecture library 4 | 5 | Public Domain (PD) 2006 MusicIP Corporation 6 | No rights reserved. 7 | 8 | -------------------------------------------------------------------*/ 9 | #include "protocol.h" 10 | #ifdef WIN32 11 | #include "io.h" 12 | #endif 13 | #include 14 | 15 | static bool readBytes(int fd, unsigned char *buf, int size) { 16 | int ct = 0; 17 | while (ct < size) { 18 | unsigned char tmp[4096]; 19 | 20 | int x = size - ct; 21 | if (x > 4096) 22 | x = 4096; 23 | 24 | int n = read(fd, tmp, x); 25 | 26 | if (n <= 0) { 27 | return false; 28 | } 29 | 30 | for (int i = 0; i < n; ++i) { 31 | buf[ct + i] = tmp[i]; 32 | } 33 | ct += n; 34 | } 35 | return true; 36 | } 37 | 38 | // This method only supports PCM/uncompressed format, with a single fmt 39 | // chunk followed by a single data chunk 40 | AudioData* loadWaveFile(char *file) { 41 | 42 | int srate = 0; 43 | int channels = 0; 44 | 45 | int fd = open(file, O_RDONLY | 0x8000); 46 | if (fd == -1) 47 | return 0; 48 | 49 | if (lseek(fd, 0L, SEEK_SET) == -1L) { 50 | close(fd); 51 | return 0; 52 | } 53 | 54 | unsigned char hdr[36]; 55 | if (!readBytes(fd, hdr, 36)) { 56 | close(fd); 57 | return 0; 58 | } 59 | if (hdr[0] != 'R' || hdr[1] != 'I' || hdr[2] != 'F' || hdr[3] != 'F') { 60 | close(fd); 61 | return 0; 62 | } 63 | // Note: bytes 4 thru 7 contain the file size - 8 bytes 64 | if (hdr[8] != 'W' || hdr[9] != 'A' || hdr[10] != 'V' || hdr[11] != 'E') { 65 | close(fd); 66 | return 0; 67 | } 68 | if (hdr[12] != 'f' || hdr[13] != 'm' || hdr[14] != 't' || hdr[15] != ' ') { 69 | close(fd); 70 | return 0; 71 | } 72 | 73 | long extraBytes = hdr[16] + (hdr[17] << 8) + (hdr[18] << 16) + (hdr[19] << 24) - 16; 74 | int compression = hdr[20] + (hdr[21] << 8); 75 | // Type 1 is PCM/Uncompressed 76 | if (compression != 1) { 77 | close(fd); 78 | return 0; 79 | } 80 | channels = hdr[22] + (hdr[23] << 8); 81 | // Only mono or stereo PCM is supported in this example 82 | if (channels < 1 || channels > 2) { 83 | close(fd); 84 | return 0; 85 | } 86 | // Samples per second, independent of number of channels 87 | srate = hdr[24] + (hdr[25] << 8) + (hdr[26] << 16) + (hdr[27] << 24); 88 | // Bytes 28-31 contain the "average bytes per second", unneeded here 89 | // Bytes 32-33 contain the number of bytes per sample (includes channels) 90 | // Bytes 34-35 contain the number of bits per single sample 91 | int bits = hdr[34] + (hdr[35] << 8); 92 | // Supporting othe sample depths will require conversion 93 | if (bits != 16) { 94 | close(fd); 95 | return 0; 96 | } 97 | 98 | // Skip past extra bytes, if any 99 | if (lseek(fd, 36L + extraBytes, SEEK_SET) == -1L) { 100 | close(fd); 101 | return 0; 102 | } 103 | 104 | // Start reading the next frame. Only supported frame is the data block 105 | unsigned char b[8]; 106 | if (!readBytes(fd, b, 8)) { 107 | close(fd); 108 | return 0; 109 | } 110 | // Do we have a fact block? 111 | if (b[0] == 'f' && b[1] == 'a' && b[2] == 'c' && b[3] == 't') { 112 | // Skip the fact block 113 | if (lseek(fd, 36L + extraBytes + 12L, SEEK_SET) == -1L) { 114 | close(fd); 115 | return 0; 116 | } 117 | // Read the next frame 118 | if (!readBytes(fd, b, 8)) { 119 | close(fd); 120 | return 0; 121 | } 122 | } 123 | 124 | // Now look for the data block 125 | if (b[0] != 'd' || b[1] != 'a' || b[2] != 't' || b[3] != 'a') { 126 | close(fd); 127 | return 0; 128 | } 129 | long bytes = b[4] + (b[5] << 8) + (b[6] << 16) + (b[7] << 24); 130 | 131 | long ms = (bytes/2)/(srate/1000); 132 | if ( channels == 2 ) ms /= 2; 133 | 134 | // No need to read the whole file, just the first 135 seconds 135 | int sampleSize = 135; 136 | long bytesInNSecs = sampleSize * srate * 2 * channels; 137 | bytes = bytes > bytesInNSecs ? bytesInNSecs : bytes; 138 | 139 | unsigned char *samples = new unsigned char[bytes]; 140 | if (!readBytes(fd, samples, bytes)) { 141 | delete[] samples; 142 | close(fd); 143 | return 0; 144 | } 145 | close(fd); 146 | 147 | AudioData *data = new AudioData(); 148 | data->setData(samples, OFA_LITTLE_ENDIAN, bytes/2, srate, 149 | channels == 2 ? 1 : 0, ms, "wav"); 150 | return data; 151 | } 152 | -------------------------------------------------------------------------------- /include/Makefile.am: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------ 2 | # 3 | # libofa -- the Open Fingerprint Architecture library 4 | # 5 | # Copyright (C) 2006 MusicIP Corporation 6 | # All rights reserved. 7 | # 8 | #------------------------------------------------------------------- 9 | AUTOMAKE_OPTIONS = foreign 10 | 11 | SUBDIRS = ofa1 12 | -------------------------------------------------------------------------------- /include/Makefile.in: -------------------------------------------------------------------------------- 1 | # Makefile.in generated by automake 1.8.5 from Makefile.am. 2 | # @configure_input@ 3 | 4 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 5 | # 2003, 2004 Free Software Foundation, Inc. 6 | # This Makefile.in is free software; the Free Software Foundation 7 | # gives unlimited permission to copy and/or distribute it, 8 | # with or without modifications, as long as this notice is preserved. 9 | 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 12 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 13 | # PARTICULAR PURPOSE. 14 | 15 | @SET_MAKE@ 16 | srcdir = @srcdir@ 17 | top_srcdir = @top_srcdir@ 18 | VPATH = @srcdir@ 19 | pkgdatadir = $(datadir)/@PACKAGE@ 20 | pkglibdir = $(libdir)/@PACKAGE@ 21 | pkgincludedir = $(includedir)/@PACKAGE@ 22 | top_builddir = .. 23 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 24 | INSTALL = @INSTALL@ 25 | install_sh_DATA = $(install_sh) -c -m 644 26 | install_sh_PROGRAM = $(install_sh) -c 27 | install_sh_SCRIPT = $(install_sh) -c 28 | INSTALL_HEADER = $(INSTALL_DATA) 29 | transform = $(program_transform_name) 30 | NORMAL_INSTALL = : 31 | PRE_INSTALL = : 32 | POST_INSTALL = : 33 | NORMAL_UNINSTALL = : 34 | PRE_UNINSTALL = : 35 | POST_UNINSTALL = : 36 | host_triplet = @host@ 37 | subdir = include 38 | DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 39 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 40 | am__aclocal_m4_deps = $(top_srcdir)/configure.in 41 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 42 | $(ACLOCAL_M4) 43 | mkinstalldirs = $(mkdir_p) 44 | CONFIG_HEADER = $(top_builddir)/config.h 45 | CONFIG_CLEAN_FILES = 46 | SOURCES = 47 | DIST_SOURCES = 48 | RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ 49 | html-recursive info-recursive install-data-recursive \ 50 | install-exec-recursive install-info-recursive \ 51 | install-recursive installcheck-recursive installdirs-recursive \ 52 | pdf-recursive ps-recursive uninstall-info-recursive \ 53 | uninstall-recursive 54 | ETAGS = etags 55 | CTAGS = ctags 56 | DIST_SUBDIRS = $(SUBDIRS) 57 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 58 | ACLOCAL = @ACLOCAL@ 59 | AMDEP_FALSE = @AMDEP_FALSE@ 60 | AMDEP_TRUE = @AMDEP_TRUE@ 61 | AMTAR = @AMTAR@ 62 | AR = @AR@ 63 | AUTOCONF = @AUTOCONF@ 64 | AUTOHEADER = @AUTOHEADER@ 65 | AUTOMAKE = @AUTOMAKE@ 66 | AWK = @AWK@ 67 | CC = @CC@ 68 | CCDEPMODE = @CCDEPMODE@ 69 | CFLAGS = @CFLAGS@ 70 | CPP = @CPP@ 71 | CPPFLAGS = @CPPFLAGS@ 72 | CURL_LIBS = @CURL_LIBS@ 73 | CXX = @CXX@ 74 | CXXCPP = @CXXCPP@ 75 | CXXDEPMODE = @CXXDEPMODE@ 76 | CXXFLAGS = @CXXFLAGS@ 77 | CYGPATH_W = @CYGPATH_W@ 78 | DARWIN_FALSE = @DARWIN_FALSE@ 79 | DARWIN_TRUE = @DARWIN_TRUE@ 80 | DEFS = @DEFS@ 81 | DEPDIR = @DEPDIR@ 82 | ECHO = @ECHO@ 83 | ECHO_C = @ECHO_C@ 84 | ECHO_N = @ECHO_N@ 85 | ECHO_T = @ECHO_T@ 86 | EGREP = @EGREP@ 87 | EXEEXT = @EXEEXT@ 88 | EXPAT_LIBS = @EXPAT_LIBS@ 89 | F77 = @F77@ 90 | FFLAGS = @FFLAGS@ 91 | FFTW3_FALSE = @FFTW3_FALSE@ 92 | FFTW3_TRUE = @FFTW3_TRUE@ 93 | FFT_WRAPPER = @FFT_WRAPPER@ 94 | FREEBSD_FALSE = @FREEBSD_FALSE@ 95 | FREEBSD_TRUE = @FREEBSD_TRUE@ 96 | INSTALL_DATA = @INSTALL_DATA@ 97 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ 98 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ 99 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 100 | LDFLAGS = @LDFLAGS@ 101 | LIBOBJS = @LIBOBJS@ 102 | LIBS = @LIBS@ 103 | LIBTOOL = @LIBTOOL@ 104 | LIBTOOL_DEPS = @LIBTOOL_DEPS@ 105 | LN_S = @LN_S@ 106 | LTLIBOBJS = @LTLIBOBJS@ 107 | MAINT = @MAINT@ 108 | MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ 109 | MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ 110 | MAKEINFO = @MAKEINFO@ 111 | OBJEXT = @OBJEXT@ 112 | PACKAGE = @PACKAGE@ 113 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ 114 | PACKAGE_NAME = @PACKAGE_NAME@ 115 | PACKAGE_STRING = @PACKAGE_STRING@ 116 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ 117 | PACKAGE_VERSION = @PACKAGE_VERSION@ 118 | PATH_SEPARATOR = @PATH_SEPARATOR@ 119 | PREFIX = @PREFIX@ 120 | RANLIB = @RANLIB@ 121 | SET_MAKE = @SET_MAKE@ 122 | SHELL = @SHELL@ 123 | STRIP = @STRIP@ 124 | VDSP_FALSE = @VDSP_FALSE@ 125 | VDSP_TRUE = @VDSP_TRUE@ 126 | VERSION = @VERSION@ 127 | ac_ct_AR = @ac_ct_AR@ 128 | ac_ct_CC = @ac_ct_CC@ 129 | ac_ct_CXX = @ac_ct_CXX@ 130 | ac_ct_F77 = @ac_ct_F77@ 131 | ac_ct_RANLIB = @ac_ct_RANLIB@ 132 | ac_ct_STRIP = @ac_ct_STRIP@ 133 | am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ 134 | am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ 135 | am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ 136 | am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 137 | am__include = @am__include@ 138 | am__leading_dot = @am__leading_dot@ 139 | am__quote = @am__quote@ 140 | bindir = @bindir@ 141 | build = @build@ 142 | build_alias = @build_alias@ 143 | build_cpu = @build_cpu@ 144 | build_os = @build_os@ 145 | build_vendor = @build_vendor@ 146 | datadir = @datadir@ 147 | exec_prefix = @exec_prefix@ 148 | host = @host@ 149 | host_alias = @host_alias@ 150 | host_cpu = @host_cpu@ 151 | host_os = @host_os@ 152 | host_vendor = @host_vendor@ 153 | includedir = @includedir@ 154 | infodir = @infodir@ 155 | install_sh = @install_sh@ 156 | libdir = @libdir@ 157 | libexecdir = @libexecdir@ 158 | localstatedir = @localstatedir@ 159 | mandir = @mandir@ 160 | mkdir_p = @mkdir_p@ 161 | oldincludedir = @oldincludedir@ 162 | prefix = @prefix@ 163 | program_transform_name = @program_transform_name@ 164 | sbindir = @sbindir@ 165 | sharedstatedir = @sharedstatedir@ 166 | sysconfdir = @sysconfdir@ 167 | target_alias = @target_alias@ 168 | 169 | # ------------------------------------------------------------------ 170 | # 171 | # libofa -- the Open Fingerprint Architecture library 172 | # 173 | # Copyright (C) 2006 MusicIP Corporation 174 | # All rights reserved. 175 | # 176 | #------------------------------------------------------------------- 177 | AUTOMAKE_OPTIONS = foreign 178 | SUBDIRS = ofa1 179 | all: all-recursive 180 | 181 | .SUFFIXES: 182 | $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) 183 | @for dep in $?; do \ 184 | case '$(am__configure_deps)' in \ 185 | *$$dep*) \ 186 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ 187 | && exit 0; \ 188 | exit 1;; \ 189 | esac; \ 190 | done; \ 191 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \ 192 | cd $(top_srcdir) && \ 193 | $(AUTOMAKE) --foreign include/Makefile 194 | .PRECIOUS: Makefile 195 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 196 | @case '$?' in \ 197 | *config.status*) \ 198 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ 199 | *) \ 200 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ 201 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 202 | esac; 203 | 204 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) 205 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 206 | 207 | $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) 208 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 209 | $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) 210 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 211 | 212 | mostlyclean-libtool: 213 | -rm -f *.lo 214 | 215 | clean-libtool: 216 | -rm -rf .libs _libs 217 | 218 | distclean-libtool: 219 | -rm -f libtool 220 | uninstall-info-am: 221 | 222 | # This directory's subdirectories are mostly independent; you can cd 223 | # into them and run `make' without going through this Makefile. 224 | # To change the values of `make' variables: instead of editing Makefiles, 225 | # (1) if the variable is set in `config.status', edit `config.status' 226 | # (which will cause the Makefiles to be regenerated when you run `make'); 227 | # (2) otherwise, pass the desired values on the `make' command line. 228 | $(RECURSIVE_TARGETS): 229 | @set fnord $$MAKEFLAGS; amf=$$2; \ 230 | dot_seen=no; \ 231 | target=`echo $@ | sed s/-recursive//`; \ 232 | list='$(SUBDIRS)'; for subdir in $$list; do \ 233 | echo "Making $$target in $$subdir"; \ 234 | if test "$$subdir" = "."; then \ 235 | dot_seen=yes; \ 236 | local_target="$$target-am"; \ 237 | else \ 238 | local_target="$$target"; \ 239 | fi; \ 240 | (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ 241 | || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ 242 | done; \ 243 | if test "$$dot_seen" = "no"; then \ 244 | $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ 245 | fi; test -z "$$fail" 246 | 247 | mostlyclean-recursive clean-recursive distclean-recursive \ 248 | maintainer-clean-recursive: 249 | @set fnord $$MAKEFLAGS; amf=$$2; \ 250 | dot_seen=no; \ 251 | case "$@" in \ 252 | distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ 253 | *) list='$(SUBDIRS)' ;; \ 254 | esac; \ 255 | rev=''; for subdir in $$list; do \ 256 | if test "$$subdir" = "."; then :; else \ 257 | rev="$$subdir $$rev"; \ 258 | fi; \ 259 | done; \ 260 | rev="$$rev ."; \ 261 | target=`echo $@ | sed s/-recursive//`; \ 262 | for subdir in $$rev; do \ 263 | echo "Making $$target in $$subdir"; \ 264 | if test "$$subdir" = "."; then \ 265 | local_target="$$target-am"; \ 266 | else \ 267 | local_target="$$target"; \ 268 | fi; \ 269 | (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ 270 | || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ 271 | done && test -z "$$fail" 272 | tags-recursive: 273 | list='$(SUBDIRS)'; for subdir in $$list; do \ 274 | test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ 275 | done 276 | ctags-recursive: 277 | list='$(SUBDIRS)'; for subdir in $$list; do \ 278 | test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ 279 | done 280 | 281 | ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) 282 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 283 | unique=`for i in $$list; do \ 284 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 285 | done | \ 286 | $(AWK) ' { files[$$0] = 1; } \ 287 | END { for (i in files) print i; }'`; \ 288 | mkid -fID $$unique 289 | tags: TAGS 290 | 291 | TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ 292 | $(TAGS_FILES) $(LISP) 293 | tags=; \ 294 | here=`pwd`; \ 295 | if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ 296 | include_option=--etags-include; \ 297 | empty_fix=.; \ 298 | else \ 299 | include_option=--include; \ 300 | empty_fix=; \ 301 | fi; \ 302 | list='$(SUBDIRS)'; for subdir in $$list; do \ 303 | if test "$$subdir" = .; then :; else \ 304 | test ! -f $$subdir/TAGS || \ 305 | tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ 306 | fi; \ 307 | done; \ 308 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 309 | unique=`for i in $$list; do \ 310 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 311 | done | \ 312 | $(AWK) ' { files[$$0] = 1; } \ 313 | END { for (i in files) print i; }'`; \ 314 | if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ 315 | test -n "$$unique" || unique=$$empty_fix; \ 316 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 317 | $$tags $$unique; \ 318 | fi 319 | ctags: CTAGS 320 | CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ 321 | $(TAGS_FILES) $(LISP) 322 | tags=; \ 323 | here=`pwd`; \ 324 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 325 | unique=`for i in $$list; do \ 326 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 327 | done | \ 328 | $(AWK) ' { files[$$0] = 1; } \ 329 | END { for (i in files) print i; }'`; \ 330 | test -z "$(CTAGS_ARGS)$$tags$$unique" \ 331 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ 332 | $$tags $$unique 333 | 334 | GTAGS: 335 | here=`$(am__cd) $(top_builddir) && pwd` \ 336 | && cd $(top_srcdir) \ 337 | && gtags -i $(GTAGS_ARGS) $$here 338 | 339 | distclean-tags: 340 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags 341 | 342 | distdir: $(DISTFILES) 343 | @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ 344 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ 345 | list='$(DISTFILES)'; for file in $$list; do \ 346 | case $$file in \ 347 | $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ 348 | $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ 349 | esac; \ 350 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ 351 | dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ 352 | if test "$$dir" != "$$file" && test "$$dir" != "."; then \ 353 | dir="/$$dir"; \ 354 | $(mkdir_p) "$(distdir)$$dir"; \ 355 | else \ 356 | dir=''; \ 357 | fi; \ 358 | if test -d $$d/$$file; then \ 359 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ 360 | cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ 361 | fi; \ 362 | cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ 363 | else \ 364 | test -f $(distdir)/$$file \ 365 | || cp -p $$d/$$file $(distdir)/$$file \ 366 | || exit 1; \ 367 | fi; \ 368 | done 369 | list='$(SUBDIRS)'; for subdir in $$list; do \ 370 | if test "$$subdir" = .; then :; else \ 371 | test -d "$(distdir)/$$subdir" \ 372 | || mkdir "$(distdir)/$$subdir" \ 373 | || exit 1; \ 374 | (cd $$subdir && \ 375 | $(MAKE) $(AM_MAKEFLAGS) \ 376 | top_distdir="../$(top_distdir)" \ 377 | distdir="../$(distdir)/$$subdir" \ 378 | distdir) \ 379 | || exit 1; \ 380 | fi; \ 381 | done 382 | check-am: all-am 383 | check: check-recursive 384 | all-am: Makefile 385 | installdirs: installdirs-recursive 386 | installdirs-am: 387 | install: install-recursive 388 | install-exec: install-exec-recursive 389 | install-data: install-data-recursive 390 | uninstall: uninstall-recursive 391 | 392 | install-am: all-am 393 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am 394 | 395 | installcheck: installcheck-recursive 396 | install-strip: 397 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 398 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ 399 | `test -z '$(STRIP)' || \ 400 | echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install 401 | mostlyclean-generic: 402 | 403 | clean-generic: 404 | 405 | distclean-generic: 406 | -rm -f $(CONFIG_CLEAN_FILES) 407 | 408 | maintainer-clean-generic: 409 | @echo "This command is intended for maintainers to use" 410 | @echo "it deletes files that may require special tools to rebuild." 411 | clean: clean-recursive 412 | 413 | clean-am: clean-generic clean-libtool mostlyclean-am 414 | 415 | distclean: distclean-recursive 416 | -rm -f Makefile 417 | distclean-am: clean-am distclean-generic distclean-libtool \ 418 | distclean-tags 419 | 420 | dvi: dvi-recursive 421 | 422 | dvi-am: 423 | 424 | html: html-recursive 425 | 426 | info: info-recursive 427 | 428 | info-am: 429 | 430 | install-data-am: 431 | 432 | install-exec-am: 433 | 434 | install-info: install-info-recursive 435 | 436 | install-man: 437 | 438 | installcheck-am: 439 | 440 | maintainer-clean: maintainer-clean-recursive 441 | -rm -f Makefile 442 | maintainer-clean-am: distclean-am maintainer-clean-generic 443 | 444 | mostlyclean: mostlyclean-recursive 445 | 446 | mostlyclean-am: mostlyclean-generic mostlyclean-libtool 447 | 448 | pdf: pdf-recursive 449 | 450 | pdf-am: 451 | 452 | ps: ps-recursive 453 | 454 | ps-am: 455 | 456 | uninstall-am: uninstall-info-am 457 | 458 | uninstall-info: uninstall-info-recursive 459 | 460 | .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ 461 | clean clean-generic clean-libtool clean-recursive ctags \ 462 | ctags-recursive distclean distclean-generic distclean-libtool \ 463 | distclean-recursive distclean-tags distdir dvi dvi-am html \ 464 | html-am info info-am install install-am install-data \ 465 | install-data-am install-exec install-exec-am install-info \ 466 | install-info-am install-man install-strip installcheck \ 467 | installcheck-am installdirs installdirs-am maintainer-clean \ 468 | maintainer-clean-generic maintainer-clean-recursive \ 469 | mostlyclean mostlyclean-generic mostlyclean-libtool \ 470 | mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ 471 | uninstall uninstall-am uninstall-info-am 472 | 473 | # Tell versions [3.59,3.63) of GNU make to not export all variables. 474 | # Otherwise a system limit (for SysV at least) may be exceeded. 475 | .NOEXPORT: 476 | -------------------------------------------------------------------------------- /include/ofa1/Makefile.am: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------ 2 | # 3 | # libofa -- the Open Fingerprint Architecture library 4 | # 5 | # Copyright (C) 2006 MusicIP Corporation 6 | # All rights reserved. 7 | # 8 | #------------------------------------------------------------------- 9 | AUTOMAKE_OPTIONS = foreign 10 | 11 | ofa_incdir = $(includedir)/ofa1 12 | ofa_inc_HEADERS = ofa.h 13 | -------------------------------------------------------------------------------- /include/ofa1/Makefile.in: -------------------------------------------------------------------------------- 1 | # Makefile.in generated by automake 1.8.5 from Makefile.am. 2 | # @configure_input@ 3 | 4 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 5 | # 2003, 2004 Free Software Foundation, Inc. 6 | # This Makefile.in is free software; the Free Software Foundation 7 | # gives unlimited permission to copy and/or distribute it, 8 | # with or without modifications, as long as this notice is preserved. 9 | 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 12 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 13 | # PARTICULAR PURPOSE. 14 | 15 | @SET_MAKE@ 16 | 17 | srcdir = @srcdir@ 18 | top_srcdir = @top_srcdir@ 19 | VPATH = @srcdir@ 20 | pkgdatadir = $(datadir)/@PACKAGE@ 21 | pkglibdir = $(libdir)/@PACKAGE@ 22 | pkgincludedir = $(includedir)/@PACKAGE@ 23 | top_builddir = ../.. 24 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 25 | INSTALL = @INSTALL@ 26 | install_sh_DATA = $(install_sh) -c -m 644 27 | install_sh_PROGRAM = $(install_sh) -c 28 | install_sh_SCRIPT = $(install_sh) -c 29 | INSTALL_HEADER = $(INSTALL_DATA) 30 | transform = $(program_transform_name) 31 | NORMAL_INSTALL = : 32 | PRE_INSTALL = : 33 | POST_INSTALL = : 34 | NORMAL_UNINSTALL = : 35 | PRE_UNINSTALL = : 36 | POST_UNINSTALL = : 37 | host_triplet = @host@ 38 | subdir = include/ofa1 39 | DIST_COMMON = $(ofa_inc_HEADERS) $(srcdir)/Makefile.am \ 40 | $(srcdir)/Makefile.in 41 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 42 | am__aclocal_m4_deps = $(top_srcdir)/configure.in 43 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 44 | $(ACLOCAL_M4) 45 | mkinstalldirs = $(mkdir_p) 46 | CONFIG_HEADER = $(top_builddir)/config.h 47 | CONFIG_CLEAN_FILES = 48 | SOURCES = 49 | DIST_SOURCES = 50 | am__installdirs = "$(DESTDIR)$(ofa_incdir)" 51 | ofa_incHEADERS_INSTALL = $(INSTALL_HEADER) 52 | HEADERS = $(ofa_inc_HEADERS) 53 | ETAGS = etags 54 | CTAGS = ctags 55 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 56 | ACLOCAL = @ACLOCAL@ 57 | AMDEP_FALSE = @AMDEP_FALSE@ 58 | AMDEP_TRUE = @AMDEP_TRUE@ 59 | AMTAR = @AMTAR@ 60 | AR = @AR@ 61 | AUTOCONF = @AUTOCONF@ 62 | AUTOHEADER = @AUTOHEADER@ 63 | AUTOMAKE = @AUTOMAKE@ 64 | AWK = @AWK@ 65 | CC = @CC@ 66 | CCDEPMODE = @CCDEPMODE@ 67 | CFLAGS = @CFLAGS@ 68 | CPP = @CPP@ 69 | CPPFLAGS = @CPPFLAGS@ 70 | CURL_LIBS = @CURL_LIBS@ 71 | CXX = @CXX@ 72 | CXXCPP = @CXXCPP@ 73 | CXXDEPMODE = @CXXDEPMODE@ 74 | CXXFLAGS = @CXXFLAGS@ 75 | CYGPATH_W = @CYGPATH_W@ 76 | DARWIN_FALSE = @DARWIN_FALSE@ 77 | DARWIN_TRUE = @DARWIN_TRUE@ 78 | DEFS = @DEFS@ 79 | DEPDIR = @DEPDIR@ 80 | ECHO = @ECHO@ 81 | ECHO_C = @ECHO_C@ 82 | ECHO_N = @ECHO_N@ 83 | ECHO_T = @ECHO_T@ 84 | EGREP = @EGREP@ 85 | EXEEXT = @EXEEXT@ 86 | EXPAT_LIBS = @EXPAT_LIBS@ 87 | F77 = @F77@ 88 | FFLAGS = @FFLAGS@ 89 | FFTW3_FALSE = @FFTW3_FALSE@ 90 | FFTW3_TRUE = @FFTW3_TRUE@ 91 | FFT_WRAPPER = @FFT_WRAPPER@ 92 | FREEBSD_FALSE = @FREEBSD_FALSE@ 93 | FREEBSD_TRUE = @FREEBSD_TRUE@ 94 | INSTALL_DATA = @INSTALL_DATA@ 95 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ 96 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ 97 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 98 | LDFLAGS = @LDFLAGS@ 99 | LIBOBJS = @LIBOBJS@ 100 | LIBS = @LIBS@ 101 | LIBTOOL = @LIBTOOL@ 102 | LIBTOOL_DEPS = @LIBTOOL_DEPS@ 103 | LN_S = @LN_S@ 104 | LTLIBOBJS = @LTLIBOBJS@ 105 | MAINT = @MAINT@ 106 | MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ 107 | MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ 108 | MAKEINFO = @MAKEINFO@ 109 | OBJEXT = @OBJEXT@ 110 | PACKAGE = @PACKAGE@ 111 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ 112 | PACKAGE_NAME = @PACKAGE_NAME@ 113 | PACKAGE_STRING = @PACKAGE_STRING@ 114 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ 115 | PACKAGE_VERSION = @PACKAGE_VERSION@ 116 | PATH_SEPARATOR = @PATH_SEPARATOR@ 117 | PREFIX = @PREFIX@ 118 | RANLIB = @RANLIB@ 119 | SET_MAKE = @SET_MAKE@ 120 | SHELL = @SHELL@ 121 | STRIP = @STRIP@ 122 | VDSP_FALSE = @VDSP_FALSE@ 123 | VDSP_TRUE = @VDSP_TRUE@ 124 | VERSION = @VERSION@ 125 | ac_ct_AR = @ac_ct_AR@ 126 | ac_ct_CC = @ac_ct_CC@ 127 | ac_ct_CXX = @ac_ct_CXX@ 128 | ac_ct_F77 = @ac_ct_F77@ 129 | ac_ct_RANLIB = @ac_ct_RANLIB@ 130 | ac_ct_STRIP = @ac_ct_STRIP@ 131 | am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ 132 | am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ 133 | am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ 134 | am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 135 | am__include = @am__include@ 136 | am__leading_dot = @am__leading_dot@ 137 | am__quote = @am__quote@ 138 | bindir = @bindir@ 139 | build = @build@ 140 | build_alias = @build_alias@ 141 | build_cpu = @build_cpu@ 142 | build_os = @build_os@ 143 | build_vendor = @build_vendor@ 144 | datadir = @datadir@ 145 | exec_prefix = @exec_prefix@ 146 | host = @host@ 147 | host_alias = @host_alias@ 148 | host_cpu = @host_cpu@ 149 | host_os = @host_os@ 150 | host_vendor = @host_vendor@ 151 | includedir = @includedir@ 152 | infodir = @infodir@ 153 | install_sh = @install_sh@ 154 | libdir = @libdir@ 155 | libexecdir = @libexecdir@ 156 | localstatedir = @localstatedir@ 157 | mandir = @mandir@ 158 | mkdir_p = @mkdir_p@ 159 | oldincludedir = @oldincludedir@ 160 | prefix = @prefix@ 161 | program_transform_name = @program_transform_name@ 162 | sbindir = @sbindir@ 163 | sharedstatedir = @sharedstatedir@ 164 | sysconfdir = @sysconfdir@ 165 | target_alias = @target_alias@ 166 | 167 | # ------------------------------------------------------------------ 168 | # 169 | # libofa -- the Open Fingerprint Architecture library 170 | # 171 | # Copyright (C) 2006 MusicIP Corporation 172 | # All rights reserved. 173 | # 174 | #------------------------------------------------------------------- 175 | AUTOMAKE_OPTIONS = foreign 176 | ofa_incdir = $(includedir)/ofa1 177 | ofa_inc_HEADERS = ofa.h 178 | all: all-am 179 | 180 | .SUFFIXES: 181 | $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) 182 | @for dep in $?; do \ 183 | case '$(am__configure_deps)' in \ 184 | *$$dep*) \ 185 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ 186 | && exit 0; \ 187 | exit 1;; \ 188 | esac; \ 189 | done; \ 190 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/ofa1/Makefile'; \ 191 | cd $(top_srcdir) && \ 192 | $(AUTOMAKE) --foreign include/ofa1/Makefile 193 | .PRECIOUS: Makefile 194 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 195 | @case '$?' in \ 196 | *config.status*) \ 197 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ 198 | *) \ 199 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ 200 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 201 | esac; 202 | 203 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) 204 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 205 | 206 | $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) 207 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 208 | $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) 209 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 210 | 211 | mostlyclean-libtool: 212 | -rm -f *.lo 213 | 214 | clean-libtool: 215 | -rm -rf .libs _libs 216 | 217 | distclean-libtool: 218 | -rm -f libtool 219 | uninstall-info-am: 220 | install-ofa_incHEADERS: $(ofa_inc_HEADERS) 221 | @$(NORMAL_INSTALL) 222 | test -z "$(ofa_incdir)" || $(mkdir_p) "$(DESTDIR)$(ofa_incdir)" 223 | @list='$(ofa_inc_HEADERS)'; for p in $$list; do \ 224 | if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ 225 | f="`echo $$p | sed -e 's|^.*/||'`"; \ 226 | echo " $(ofa_incHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(ofa_incdir)/$$f'"; \ 227 | $(ofa_incHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(ofa_incdir)/$$f"; \ 228 | done 229 | 230 | uninstall-ofa_incHEADERS: 231 | @$(NORMAL_UNINSTALL) 232 | @list='$(ofa_inc_HEADERS)'; for p in $$list; do \ 233 | f="`echo $$p | sed -e 's|^.*/||'`"; \ 234 | echo " rm -f '$(DESTDIR)$(ofa_incdir)/$$f'"; \ 235 | rm -f "$(DESTDIR)$(ofa_incdir)/$$f"; \ 236 | done 237 | 238 | ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) 239 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 240 | unique=`for i in $$list; do \ 241 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 242 | done | \ 243 | $(AWK) ' { files[$$0] = 1; } \ 244 | END { for (i in files) print i; }'`; \ 245 | mkid -fID $$unique 246 | tags: TAGS 247 | 248 | TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ 249 | $(TAGS_FILES) $(LISP) 250 | tags=; \ 251 | here=`pwd`; \ 252 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 253 | unique=`for i in $$list; do \ 254 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 255 | done | \ 256 | $(AWK) ' { files[$$0] = 1; } \ 257 | END { for (i in files) print i; }'`; \ 258 | if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ 259 | test -n "$$unique" || unique=$$empty_fix; \ 260 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 261 | $$tags $$unique; \ 262 | fi 263 | ctags: CTAGS 264 | CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ 265 | $(TAGS_FILES) $(LISP) 266 | tags=; \ 267 | here=`pwd`; \ 268 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 269 | unique=`for i in $$list; do \ 270 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 271 | done | \ 272 | $(AWK) ' { files[$$0] = 1; } \ 273 | END { for (i in files) print i; }'`; \ 274 | test -z "$(CTAGS_ARGS)$$tags$$unique" \ 275 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ 276 | $$tags $$unique 277 | 278 | GTAGS: 279 | here=`$(am__cd) $(top_builddir) && pwd` \ 280 | && cd $(top_srcdir) \ 281 | && gtags -i $(GTAGS_ARGS) $$here 282 | 283 | distclean-tags: 284 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags 285 | 286 | distdir: $(DISTFILES) 287 | @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ 288 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ 289 | list='$(DISTFILES)'; for file in $$list; do \ 290 | case $$file in \ 291 | $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ 292 | $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ 293 | esac; \ 294 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ 295 | dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ 296 | if test "$$dir" != "$$file" && test "$$dir" != "."; then \ 297 | dir="/$$dir"; \ 298 | $(mkdir_p) "$(distdir)$$dir"; \ 299 | else \ 300 | dir=''; \ 301 | fi; \ 302 | if test -d $$d/$$file; then \ 303 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ 304 | cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ 305 | fi; \ 306 | cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ 307 | else \ 308 | test -f $(distdir)/$$file \ 309 | || cp -p $$d/$$file $(distdir)/$$file \ 310 | || exit 1; \ 311 | fi; \ 312 | done 313 | check-am: all-am 314 | check: check-am 315 | all-am: Makefile $(HEADERS) 316 | installdirs: 317 | for dir in "$(DESTDIR)$(ofa_incdir)"; do \ 318 | test -z "$$dir" || $(mkdir_p) "$$dir"; \ 319 | done 320 | install: install-am 321 | install-exec: install-exec-am 322 | install-data: install-data-am 323 | uninstall: uninstall-am 324 | 325 | install-am: all-am 326 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am 327 | 328 | installcheck: installcheck-am 329 | install-strip: 330 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 331 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ 332 | `test -z '$(STRIP)' || \ 333 | echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install 334 | mostlyclean-generic: 335 | 336 | clean-generic: 337 | 338 | distclean-generic: 339 | -rm -f $(CONFIG_CLEAN_FILES) 340 | 341 | maintainer-clean-generic: 342 | @echo "This command is intended for maintainers to use" 343 | @echo "it deletes files that may require special tools to rebuild." 344 | clean: clean-am 345 | 346 | clean-am: clean-generic clean-libtool mostlyclean-am 347 | 348 | distclean: distclean-am 349 | -rm -f Makefile 350 | distclean-am: clean-am distclean-generic distclean-libtool \ 351 | distclean-tags 352 | 353 | dvi: dvi-am 354 | 355 | dvi-am: 356 | 357 | html: html-am 358 | 359 | info: info-am 360 | 361 | info-am: 362 | 363 | install-data-am: install-ofa_incHEADERS 364 | 365 | install-exec-am: 366 | 367 | install-info: install-info-am 368 | 369 | install-man: 370 | 371 | installcheck-am: 372 | 373 | maintainer-clean: maintainer-clean-am 374 | -rm -f Makefile 375 | maintainer-clean-am: distclean-am maintainer-clean-generic 376 | 377 | mostlyclean: mostlyclean-am 378 | 379 | mostlyclean-am: mostlyclean-generic mostlyclean-libtool 380 | 381 | pdf: pdf-am 382 | 383 | pdf-am: 384 | 385 | ps: ps-am 386 | 387 | ps-am: 388 | 389 | uninstall-am: uninstall-info-am uninstall-ofa_incHEADERS 390 | 391 | .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ 392 | clean-libtool ctags distclean distclean-generic \ 393 | distclean-libtool distclean-tags distdir dvi dvi-am html \ 394 | html-am info info-am install install-am install-data \ 395 | install-data-am install-exec install-exec-am install-info \ 396 | install-info-am install-man install-ofa_incHEADERS \ 397 | install-strip installcheck installcheck-am installdirs \ 398 | maintainer-clean maintainer-clean-generic mostlyclean \ 399 | mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ 400 | tags uninstall uninstall-am uninstall-info-am \ 401 | uninstall-ofa_incHEADERS 402 | 403 | # Tell versions [3.59,3.63) of GNU make to not export all variables. 404 | # Otherwise a system limit (for SysV at least) may be exceeded. 405 | .NOEXPORT: 406 | -------------------------------------------------------------------------------- /include/ofa1/ofa.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | 3 | libofa -- the Open Fingerprint Architecture library 4 | 5 | Copyright (C) 2006 MusicIP Corporation 6 | All rights reserved. 7 | 8 | -------------------------------------------------------------------*/ 9 | #ifndef _OFA_H_ 10 | #define _OFA_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" 14 | { 15 | #endif 16 | 17 | #define OFA_LITTLE_ENDIAN (0) 18 | #define OFA_BIG_ENDIAN (1) 19 | 20 | /* Retrieve the version of the library */ 21 | void ofa_get_version(int *major, int *minor, int *rev); 22 | 23 | /* This is the simplest interface required to generate fingerprints. 24 | examples/protocol.h defines some higher level classes which can be connected 25 | to codecs in various formats for a higher level API */ 26 | const char *ofa_create_print(unsigned char* samples, int byteOrder, long size, int sRate, int stereo); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /install-sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # install - install a program, script, or datafile 3 | 4 | scriptversion=2004-04-01.17 5 | 6 | # This originates from X11R5 (mit/util/scripts/install.sh), which was 7 | # later released in X11R6 (xc/config/util/install.sh) with the 8 | # following copyright and license. 9 | # 10 | # Copyright (C) 1994 X Consortium 11 | # 12 | # Permission is hereby granted, free of charge, to any person obtaining a copy 13 | # of this software and associated documentation files (the "Software"), to 14 | # deal in the Software without restriction, including without limitation the 15 | # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 16 | # sell copies of the Software, and to permit persons to whom the Software is 17 | # furnished to do so, subject to the following conditions: 18 | # 19 | # The above copyright notice and this permission notice shall be included in 20 | # all copies or substantial portions of the Software. 21 | # 22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 26 | # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- 27 | # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | # 29 | # Except as contained in this notice, the name of the X Consortium shall not 30 | # be used in advertising or otherwise to promote the sale, use or other deal- 31 | # ings in this Software without prior written authorization from the X Consor- 32 | # tium. 33 | # 34 | # 35 | # FSF changes to this file are in the public domain. 36 | # 37 | # Calling this script install-sh is preferred over install.sh, to prevent 38 | # `make' implicit rules from creating a file called install from it 39 | # when there is no Makefile. 40 | # 41 | # This script is compatible with the BSD install script, but was written 42 | # from scratch. It can only install one file at a time, a restriction 43 | # shared with many OS's install programs. 44 | 45 | # set DOITPROG to echo to test this script 46 | 47 | # Don't use :- since 4.3BSD and earlier shells don't like it. 48 | doit="${DOITPROG-}" 49 | 50 | # put in absolute paths if you don't have them in your path; or use env. vars. 51 | 52 | mvprog="${MVPROG-mv}" 53 | cpprog="${CPPROG-cp}" 54 | chmodprog="${CHMODPROG-chmod}" 55 | chownprog="${CHOWNPROG-chown}" 56 | chgrpprog="${CHGRPPROG-chgrp}" 57 | stripprog="${STRIPPROG-strip}" 58 | rmprog="${RMPROG-rm}" 59 | mkdirprog="${MKDIRPROG-mkdir}" 60 | 61 | transformbasename= 62 | transform_arg= 63 | instcmd="$mvprog" 64 | chmodcmd="$chmodprog 0755" 65 | chowncmd= 66 | chgrpcmd= 67 | stripcmd= 68 | rmcmd="$rmprog -f" 69 | mvcmd="$mvprog" 70 | src= 71 | dst= 72 | dir_arg= 73 | 74 | usage="Usage: $0 [OPTION]... SRCFILE DSTFILE 75 | or: $0 [OPTION]... SRCFILES... DIRECTORY 76 | or: $0 -d DIRECTORIES... 77 | 78 | In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default. 79 | In the second, create the directory path DIR. 80 | 81 | Options: 82 | -b=TRANSFORMBASENAME 83 | -c copy source (using $cpprog) instead of moving (using $mvprog). 84 | -d create directories instead of installing files. 85 | -g GROUP $chgrp installed files to GROUP. 86 | -m MODE $chmod installed files to MODE. 87 | -o USER $chown installed files to USER. 88 | -s strip installed files (using $stripprog). 89 | -t=TRANSFORM 90 | --help display this help and exit. 91 | --version display version info and exit. 92 | 93 | Environment variables override the default commands: 94 | CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG 95 | " 96 | 97 | while test -n "$1"; do 98 | case $1 in 99 | -b=*) transformbasename=`echo $1 | sed 's/-b=//'` 100 | shift 101 | continue;; 102 | 103 | -c) instcmd=$cpprog 104 | shift 105 | continue;; 106 | 107 | -d) dir_arg=true 108 | shift 109 | continue;; 110 | 111 | -g) chgrpcmd="$chgrpprog $2" 112 | shift 113 | shift 114 | continue;; 115 | 116 | --help) echo "$usage"; exit 0;; 117 | 118 | -m) chmodcmd="$chmodprog $2" 119 | shift 120 | shift 121 | continue;; 122 | 123 | -o) chowncmd="$chownprog $2" 124 | shift 125 | shift 126 | continue;; 127 | 128 | -s) stripcmd=$stripprog 129 | shift 130 | continue;; 131 | 132 | -t=*) transformarg=`echo $1 | sed 's/-t=//'` 133 | shift 134 | continue;; 135 | 136 | --version) echo "$0 $scriptversion"; exit 0;; 137 | 138 | *) # When -d is used, all remaining arguments are directories to create. 139 | test -n "$dir_arg" && break 140 | # Otherwise, the last argument is the destination. Remove it from $@. 141 | for arg 142 | do 143 | if test -n "$dstarg"; then 144 | # $@ is not empty: it contains at least $arg. 145 | set fnord "$@" "$dstarg" 146 | shift # fnord 147 | fi 148 | shift # arg 149 | dstarg=$arg 150 | done 151 | break;; 152 | esac 153 | done 154 | 155 | if test -z "$1"; then 156 | if test -z "$dir_arg"; then 157 | echo "$0: no input file specified." >&2 158 | exit 1 159 | fi 160 | # It's OK to call `install-sh -d' without argument. 161 | # This can happen when creating conditional directories. 162 | exit 0 163 | fi 164 | 165 | for src 166 | do 167 | # Protect names starting with `-'. 168 | case $src in 169 | -*) src=./$src ;; 170 | esac 171 | 172 | if test -n "$dir_arg"; then 173 | dst=$src 174 | src= 175 | 176 | if test -d "$dst"; then 177 | instcmd=: 178 | chmodcmd= 179 | else 180 | instcmd=$mkdirprog 181 | fi 182 | else 183 | # Waiting for this to be detected by the "$instcmd $src $dsttmp" command 184 | # might cause directories to be created, which would be especially bad 185 | # if $src (and thus $dsttmp) contains '*'. 186 | if test ! -f "$src" && test ! -d "$src"; then 187 | echo "$0: $src does not exist." >&2 188 | exit 1 189 | fi 190 | 191 | if test -z "$dstarg"; then 192 | echo "$0: no destination specified." >&2 193 | exit 1 194 | fi 195 | 196 | dst=$dstarg 197 | # Protect names starting with `-'. 198 | case $dst in 199 | -*) dst=./$dst ;; 200 | esac 201 | 202 | # If destination is a directory, append the input filename; won't work 203 | # if double slashes aren't ignored. 204 | if test -d "$dst"; then 205 | dst=$dst/`basename "$src"` 206 | fi 207 | fi 208 | 209 | # This sed command emulates the dirname command. 210 | dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` 211 | 212 | # Make sure that the destination directory exists. 213 | 214 | # Skip lots of stat calls in the usual case. 215 | if test ! -d "$dstdir"; then 216 | defaultIFS=' 217 | ' 218 | IFS="${IFS-$defaultIFS}" 219 | 220 | oIFS=$IFS 221 | # Some sh's can't handle IFS=/ for some reason. 222 | IFS='%' 223 | set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` 224 | IFS=$oIFS 225 | 226 | pathcomp= 227 | 228 | while test $# -ne 0 ; do 229 | pathcomp=$pathcomp$1 230 | shift 231 | if test ! -d "$pathcomp"; then 232 | $mkdirprog "$pathcomp" || lasterr=$? 233 | # mkdir can fail with a `File exist' error in case several 234 | # install-sh are creating the directory concurrently. This 235 | # is OK. 236 | test ! -d "$pathcomp" && { (exit ${lasterr-1}); exit; } 237 | fi 238 | pathcomp=$pathcomp/ 239 | done 240 | fi 241 | 242 | if test -n "$dir_arg"; then 243 | $doit $instcmd "$dst" \ 244 | && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ 245 | && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ 246 | && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ 247 | && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } 248 | 249 | else 250 | # If we're going to rename the final executable, determine the name now. 251 | if test -z "$transformarg"; then 252 | dstfile=`basename "$dst"` 253 | else 254 | dstfile=`basename "$dst" $transformbasename \ 255 | | sed $transformarg`$transformbasename 256 | fi 257 | 258 | # don't allow the sed command to completely eliminate the filename. 259 | test -z "$dstfile" && dstfile=`basename "$dst"` 260 | 261 | # Make a couple of temp file names in the proper directory. 262 | dsttmp=$dstdir/_inst.$$_ 263 | rmtmp=$dstdir/_rm.$$_ 264 | 265 | # Trap to clean up those temp files at exit. 266 | trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 267 | trap '(exit $?); exit' 1 2 13 15 268 | 269 | # Move or copy the file name to the temp name 270 | $doit $instcmd "$src" "$dsttmp" && 271 | 272 | # and set any options; do chmod last to preserve setuid bits. 273 | # 274 | # If any of these fail, we abort the whole thing. If we want to 275 | # ignore errors from any of these, just make sure not to ignore 276 | # errors from the above "$doit $instcmd $src $dsttmp" command. 277 | # 278 | { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ 279 | && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ 280 | && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ 281 | && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && 282 | 283 | # Now rename the file to the real destination. 284 | { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ 285 | || { 286 | # The rename failed, perhaps because mv can't rename something else 287 | # to itself, or perhaps because mv is so ancient that it does not 288 | # support -f. 289 | 290 | # Now remove or move aside any old file at destination location. 291 | # We try this two ways since rm can't unlink itself on some 292 | # systems and the destination file might be busy for other 293 | # reasons. In this case, the final cleanup might fail but the new 294 | # file should still install successfully. 295 | { 296 | if test -f "$dstdir/$dstfile"; then 297 | $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ 298 | || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ 299 | || { 300 | echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 301 | (exit 1); exit 302 | } 303 | else 304 | : 305 | fi 306 | } && 307 | 308 | # Now rename the file to the real destination. 309 | $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" 310 | } 311 | } 312 | fi || { (exit 1); exit; } 313 | done 314 | 315 | # The final little trick to "correctly" pass the exit status to the exit trap. 316 | { 317 | (exit 0); exit 318 | } 319 | 320 | # Local variables: 321 | # eval: (add-hook 'write-file-hooks 'time-stamp) 322 | # time-stamp-start: "scriptversion=" 323 | # time-stamp-format: "%:y-%02m-%02d.%02H" 324 | # time-stamp-end: "$" 325 | # End: 326 | -------------------------------------------------------------------------------- /lib/AFLIB/Makefile.am: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------ 2 | # 3 | # libofa -- the Open Fingerprint Architecture library 4 | # 5 | # Copyright (C) 2006 MusicIP Corporation 6 | # All rights reserved. 7 | # 8 | #------------------------------------------------------------------- 9 | noinst_LTLIBRARIES = libaflib.la 10 | libaflib_la_SOURCES = aflibConverter.cpp aflibConverter.h aflibConverterLargeFilter.h aflibConverterSmallFilter.h 11 | 12 | #EXTRA_DIST = aflibConverter.h aflibConverterLargeFilter.h aflibConverterSmallFilter.h 13 | -------------------------------------------------------------------------------- /lib/AFLIB/Makefile.in: -------------------------------------------------------------------------------- 1 | # Makefile.in generated by automake 1.8.5 from Makefile.am. 2 | # @configure_input@ 3 | 4 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 5 | # 2003, 2004 Free Software Foundation, Inc. 6 | # This Makefile.in is free software; the Free Software Foundation 7 | # gives unlimited permission to copy and/or distribute it, 8 | # with or without modifications, as long as this notice is preserved. 9 | 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 12 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 13 | # PARTICULAR PURPOSE. 14 | 15 | @SET_MAKE@ 16 | 17 | SOURCES = $(libaflib_la_SOURCES) 18 | 19 | srcdir = @srcdir@ 20 | top_srcdir = @top_srcdir@ 21 | VPATH = @srcdir@ 22 | pkgdatadir = $(datadir)/@PACKAGE@ 23 | pkglibdir = $(libdir)/@PACKAGE@ 24 | pkgincludedir = $(includedir)/@PACKAGE@ 25 | top_builddir = ../.. 26 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 27 | INSTALL = @INSTALL@ 28 | install_sh_DATA = $(install_sh) -c -m 644 29 | install_sh_PROGRAM = $(install_sh) -c 30 | install_sh_SCRIPT = $(install_sh) -c 31 | INSTALL_HEADER = $(INSTALL_DATA) 32 | transform = $(program_transform_name) 33 | NORMAL_INSTALL = : 34 | PRE_INSTALL = : 35 | POST_INSTALL = : 36 | NORMAL_UNINSTALL = : 37 | PRE_UNINSTALL = : 38 | POST_UNINSTALL = : 39 | host_triplet = @host@ 40 | subdir = lib/AFLIB 41 | DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 42 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 43 | am__aclocal_m4_deps = $(top_srcdir)/configure.in 44 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 45 | $(ACLOCAL_M4) 46 | mkinstalldirs = $(mkdir_p) 47 | CONFIG_HEADER = $(top_builddir)/config.h 48 | CONFIG_CLEAN_FILES = 49 | LTLIBRARIES = $(noinst_LTLIBRARIES) 50 | libaflib_la_LIBADD = 51 | am_libaflib_la_OBJECTS = aflibConverter.lo 52 | libaflib_la_OBJECTS = $(am_libaflib_la_OBJECTS) 53 | DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) 54 | depcomp = $(SHELL) $(top_srcdir)/depcomp 55 | am__depfiles_maybe = depfiles 56 | @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/aflibConverter.Plo 57 | CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ 58 | $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) 59 | LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ 60 | $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ 61 | $(AM_CXXFLAGS) $(CXXFLAGS) 62 | CXXLD = $(CXX) 63 | CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ 64 | $(AM_LDFLAGS) $(LDFLAGS) -o $@ 65 | COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ 66 | $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) 67 | LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ 68 | $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ 69 | $(AM_CFLAGS) $(CFLAGS) 70 | CCLD = $(CC) 71 | LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ 72 | $(AM_LDFLAGS) $(LDFLAGS) -o $@ 73 | SOURCES = $(libaflib_la_SOURCES) 74 | DIST_SOURCES = $(libaflib_la_SOURCES) 75 | ETAGS = etags 76 | CTAGS = ctags 77 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 78 | ACLOCAL = @ACLOCAL@ 79 | AMDEP_FALSE = @AMDEP_FALSE@ 80 | AMDEP_TRUE = @AMDEP_TRUE@ 81 | AMTAR = @AMTAR@ 82 | AR = @AR@ 83 | AUTOCONF = @AUTOCONF@ 84 | AUTOHEADER = @AUTOHEADER@ 85 | AUTOMAKE = @AUTOMAKE@ 86 | AWK = @AWK@ 87 | CC = @CC@ 88 | CCDEPMODE = @CCDEPMODE@ 89 | CFLAGS = @CFLAGS@ 90 | CPP = @CPP@ 91 | CPPFLAGS = @CPPFLAGS@ 92 | CURL_LIBS = @CURL_LIBS@ 93 | CXX = @CXX@ 94 | CXXCPP = @CXXCPP@ 95 | CXXDEPMODE = @CXXDEPMODE@ 96 | CXXFLAGS = @CXXFLAGS@ 97 | CYGPATH_W = @CYGPATH_W@ 98 | DARWIN_FALSE = @DARWIN_FALSE@ 99 | DARWIN_TRUE = @DARWIN_TRUE@ 100 | DEFS = @DEFS@ 101 | DEPDIR = @DEPDIR@ 102 | ECHO = @ECHO@ 103 | ECHO_C = @ECHO_C@ 104 | ECHO_N = @ECHO_N@ 105 | ECHO_T = @ECHO_T@ 106 | EGREP = @EGREP@ 107 | EXEEXT = @EXEEXT@ 108 | EXPAT_LIBS = @EXPAT_LIBS@ 109 | F77 = @F77@ 110 | FFLAGS = @FFLAGS@ 111 | FFTW3_FALSE = @FFTW3_FALSE@ 112 | FFTW3_TRUE = @FFTW3_TRUE@ 113 | FFT_WRAPPER = @FFT_WRAPPER@ 114 | FREEBSD_FALSE = @FREEBSD_FALSE@ 115 | FREEBSD_TRUE = @FREEBSD_TRUE@ 116 | INSTALL_DATA = @INSTALL_DATA@ 117 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ 118 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ 119 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 120 | LDFLAGS = @LDFLAGS@ 121 | LIBOBJS = @LIBOBJS@ 122 | LIBS = @LIBS@ 123 | LIBTOOL = @LIBTOOL@ 124 | LIBTOOL_DEPS = @LIBTOOL_DEPS@ 125 | LN_S = @LN_S@ 126 | LTLIBOBJS = @LTLIBOBJS@ 127 | MAINT = @MAINT@ 128 | MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ 129 | MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ 130 | MAKEINFO = @MAKEINFO@ 131 | OBJEXT = @OBJEXT@ 132 | PACKAGE = @PACKAGE@ 133 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ 134 | PACKAGE_NAME = @PACKAGE_NAME@ 135 | PACKAGE_STRING = @PACKAGE_STRING@ 136 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ 137 | PACKAGE_VERSION = @PACKAGE_VERSION@ 138 | PATH_SEPARATOR = @PATH_SEPARATOR@ 139 | PREFIX = @PREFIX@ 140 | RANLIB = @RANLIB@ 141 | SET_MAKE = @SET_MAKE@ 142 | SHELL = @SHELL@ 143 | STRIP = @STRIP@ 144 | VDSP_FALSE = @VDSP_FALSE@ 145 | VDSP_TRUE = @VDSP_TRUE@ 146 | VERSION = @VERSION@ 147 | ac_ct_AR = @ac_ct_AR@ 148 | ac_ct_CC = @ac_ct_CC@ 149 | ac_ct_CXX = @ac_ct_CXX@ 150 | ac_ct_F77 = @ac_ct_F77@ 151 | ac_ct_RANLIB = @ac_ct_RANLIB@ 152 | ac_ct_STRIP = @ac_ct_STRIP@ 153 | am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ 154 | am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ 155 | am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ 156 | am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 157 | am__include = @am__include@ 158 | am__leading_dot = @am__leading_dot@ 159 | am__quote = @am__quote@ 160 | bindir = @bindir@ 161 | build = @build@ 162 | build_alias = @build_alias@ 163 | build_cpu = @build_cpu@ 164 | build_os = @build_os@ 165 | build_vendor = @build_vendor@ 166 | datadir = @datadir@ 167 | exec_prefix = @exec_prefix@ 168 | host = @host@ 169 | host_alias = @host_alias@ 170 | host_cpu = @host_cpu@ 171 | host_os = @host_os@ 172 | host_vendor = @host_vendor@ 173 | includedir = @includedir@ 174 | infodir = @infodir@ 175 | install_sh = @install_sh@ 176 | libdir = @libdir@ 177 | libexecdir = @libexecdir@ 178 | localstatedir = @localstatedir@ 179 | mandir = @mandir@ 180 | mkdir_p = @mkdir_p@ 181 | oldincludedir = @oldincludedir@ 182 | prefix = @prefix@ 183 | program_transform_name = @program_transform_name@ 184 | sbindir = @sbindir@ 185 | sharedstatedir = @sharedstatedir@ 186 | sysconfdir = @sysconfdir@ 187 | target_alias = @target_alias@ 188 | 189 | # ------------------------------------------------------------------ 190 | # 191 | # libofa -- the Open Fingerprint Architecture library 192 | # 193 | # Copyright (C) 2006 MusicIP Corporation 194 | # All rights reserved. 195 | # 196 | #------------------------------------------------------------------- 197 | noinst_LTLIBRARIES = libaflib.la 198 | libaflib_la_SOURCES = aflibConverter.cpp aflibConverter.h aflibConverterLargeFilter.h aflibConverterSmallFilter.h 199 | all: all-am 200 | 201 | .SUFFIXES: 202 | .SUFFIXES: .cpp .lo .o .obj 203 | $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) 204 | @for dep in $?; do \ 205 | case '$(am__configure_deps)' in \ 206 | *$$dep*) \ 207 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ 208 | && exit 0; \ 209 | exit 1;; \ 210 | esac; \ 211 | done; \ 212 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/AFLIB/Makefile'; \ 213 | cd $(top_srcdir) && \ 214 | $(AUTOMAKE) --gnu lib/AFLIB/Makefile 215 | .PRECIOUS: Makefile 216 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 217 | @case '$?' in \ 218 | *config.status*) \ 219 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ 220 | *) \ 221 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ 222 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 223 | esac; 224 | 225 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) 226 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 227 | 228 | $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) 229 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 230 | $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) 231 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 232 | 233 | clean-noinstLTLIBRARIES: 234 | -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) 235 | @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ 236 | dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ 237 | test "$$dir" != "$$p" || dir=.; \ 238 | echo "rm -f \"$${dir}/so_locations\""; \ 239 | rm -f "$${dir}/so_locations"; \ 240 | done 241 | libaflib.la: $(libaflib_la_OBJECTS) $(libaflib_la_DEPENDENCIES) 242 | $(CXXLINK) $(libaflib_la_LDFLAGS) $(libaflib_la_OBJECTS) $(libaflib_la_LIBADD) $(LIBS) 243 | 244 | mostlyclean-compile: 245 | -rm -f *.$(OBJEXT) 246 | 247 | distclean-compile: 248 | -rm -f *.tab.c 249 | 250 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aflibConverter.Plo@am__quote@ 251 | 252 | .cpp.o: 253 | @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ 254 | @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi 255 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ 256 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ 257 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 258 | @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< 259 | 260 | .cpp.obj: 261 | @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ 262 | @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi 263 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ 264 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ 265 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 266 | @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` 267 | 268 | .cpp.lo: 269 | @am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ 270 | @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi 271 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ 272 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ 273 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 274 | @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< 275 | 276 | mostlyclean-libtool: 277 | -rm -f *.lo 278 | 279 | clean-libtool: 280 | -rm -rf .libs _libs 281 | 282 | distclean-libtool: 283 | -rm -f libtool 284 | uninstall-info-am: 285 | 286 | ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) 287 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 288 | unique=`for i in $$list; do \ 289 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 290 | done | \ 291 | $(AWK) ' { files[$$0] = 1; } \ 292 | END { for (i in files) print i; }'`; \ 293 | mkid -fID $$unique 294 | tags: TAGS 295 | 296 | TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ 297 | $(TAGS_FILES) $(LISP) 298 | tags=; \ 299 | here=`pwd`; \ 300 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 301 | unique=`for i in $$list; do \ 302 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 303 | done | \ 304 | $(AWK) ' { files[$$0] = 1; } \ 305 | END { for (i in files) print i; }'`; \ 306 | if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ 307 | test -n "$$unique" || unique=$$empty_fix; \ 308 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 309 | $$tags $$unique; \ 310 | fi 311 | ctags: CTAGS 312 | CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ 313 | $(TAGS_FILES) $(LISP) 314 | tags=; \ 315 | here=`pwd`; \ 316 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 317 | unique=`for i in $$list; do \ 318 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 319 | done | \ 320 | $(AWK) ' { files[$$0] = 1; } \ 321 | END { for (i in files) print i; }'`; \ 322 | test -z "$(CTAGS_ARGS)$$tags$$unique" \ 323 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ 324 | $$tags $$unique 325 | 326 | GTAGS: 327 | here=`$(am__cd) $(top_builddir) && pwd` \ 328 | && cd $(top_srcdir) \ 329 | && gtags -i $(GTAGS_ARGS) $$here 330 | 331 | distclean-tags: 332 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags 333 | 334 | distdir: $(DISTFILES) 335 | @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ 336 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ 337 | list='$(DISTFILES)'; for file in $$list; do \ 338 | case $$file in \ 339 | $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ 340 | $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ 341 | esac; \ 342 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ 343 | dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ 344 | if test "$$dir" != "$$file" && test "$$dir" != "."; then \ 345 | dir="/$$dir"; \ 346 | $(mkdir_p) "$(distdir)$$dir"; \ 347 | else \ 348 | dir=''; \ 349 | fi; \ 350 | if test -d $$d/$$file; then \ 351 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ 352 | cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ 353 | fi; \ 354 | cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ 355 | else \ 356 | test -f $(distdir)/$$file \ 357 | || cp -p $$d/$$file $(distdir)/$$file \ 358 | || exit 1; \ 359 | fi; \ 360 | done 361 | check-am: all-am 362 | check: check-am 363 | all-am: Makefile $(LTLIBRARIES) 364 | installdirs: 365 | install: install-am 366 | install-exec: install-exec-am 367 | install-data: install-data-am 368 | uninstall: uninstall-am 369 | 370 | install-am: all-am 371 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am 372 | 373 | installcheck: installcheck-am 374 | install-strip: 375 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 376 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ 377 | `test -z '$(STRIP)' || \ 378 | echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install 379 | mostlyclean-generic: 380 | 381 | clean-generic: 382 | 383 | distclean-generic: 384 | -rm -f $(CONFIG_CLEAN_FILES) 385 | 386 | maintainer-clean-generic: 387 | @echo "This command is intended for maintainers to use" 388 | @echo "it deletes files that may require special tools to rebuild." 389 | clean: clean-am 390 | 391 | clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ 392 | mostlyclean-am 393 | 394 | distclean: distclean-am 395 | -rm -rf ./$(DEPDIR) 396 | -rm -f Makefile 397 | distclean-am: clean-am distclean-compile distclean-generic \ 398 | distclean-libtool distclean-tags 399 | 400 | dvi: dvi-am 401 | 402 | dvi-am: 403 | 404 | html: html-am 405 | 406 | info: info-am 407 | 408 | info-am: 409 | 410 | install-data-am: 411 | 412 | install-exec-am: 413 | 414 | install-info: install-info-am 415 | 416 | install-man: 417 | 418 | installcheck-am: 419 | 420 | maintainer-clean: maintainer-clean-am 421 | -rm -rf ./$(DEPDIR) 422 | -rm -f Makefile 423 | maintainer-clean-am: distclean-am maintainer-clean-generic 424 | 425 | mostlyclean: mostlyclean-am 426 | 427 | mostlyclean-am: mostlyclean-compile mostlyclean-generic \ 428 | mostlyclean-libtool 429 | 430 | pdf: pdf-am 431 | 432 | pdf-am: 433 | 434 | ps: ps-am 435 | 436 | ps-am: 437 | 438 | uninstall-am: uninstall-info-am 439 | 440 | .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ 441 | clean-libtool clean-noinstLTLIBRARIES ctags distclean \ 442 | distclean-compile distclean-generic distclean-libtool \ 443 | distclean-tags distdir dvi dvi-am html html-am info info-am \ 444 | install install-am install-data install-data-am install-exec \ 445 | install-exec-am install-info install-info-am install-man \ 446 | install-strip installcheck installcheck-am installdirs \ 447 | maintainer-clean maintainer-clean-generic mostlyclean \ 448 | mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ 449 | pdf pdf-am ps ps-am tags uninstall uninstall-am \ 450 | uninstall-info-am 451 | 452 | 453 | #EXTRA_DIST = aflibConverter.h aflibConverterLargeFilter.h aflibConverterSmallFilter.h 454 | # Tell versions [3.59,3.63) of GNU make to not export all variables. 455 | # Otherwise a system limit (for SysV at least) may be exceeded. 456 | .NOEXPORT: 457 | -------------------------------------------------------------------------------- /lib/AFLIB/aflibConverter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright: (C) 2000 Julius O. Smith 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Julius O. Smith jos@ccrma.stanford.edu 19 | * 20 | */ 21 | /* This code was modified by Bruce Forsberg (forsberg@tns.net) to make it 22 | into a C++ class 23 | */ 24 | 25 | 26 | #ifndef _AFLIBCONVERTER_H_ 27 | #define _AFLIBCONVERTER_H_ 28 | 29 | /* 30 | #ifdef HAVE_CONFIG_H 31 | #include 32 | #endif 33 | */ 34 | 35 | #ifndef MAX 36 | #define MAX(x,y) ((x)>(y) ?(x):(y)) 37 | #endif 38 | #ifndef MIN 39 | #define MIN(x,y) ((x)<(y) ?(x):(y)) 40 | #endif 41 | 42 | #define MAX_HWORD (32767) 43 | #define MIN_HWORD (-32768) 44 | 45 | #define IBUFFSIZE 4096 /* Input buffer size */ 46 | 47 | /*! \class aflibConverter 48 | \brief Provides sample rate conversion. 49 | 50 | This class will perform audio resampling. With the constructor you can choose the 51 | type of resampling to be done. Simple linear interpolation can be done by setting 52 | linear_interpolation to be TRUE in the constructor. The other two flags are 53 | ignored if this is set. If linear_interpolation is FALSE then some form of filtering 54 | will be done. IF high_quality is FALSE then a small filter will be performed. 55 | If high_quality is TRUE then a large filter (higher quality) will be performed. For 56 | both the small and large filters another parameter can be specified, filter_interpolation. 57 | With filter_interpolation set then the filter coefficients used for both the small and 58 | large filtering will be interpolated as well. 59 | 60 | This class was designed to stream audio data. It also expects audio data as 16 bit values. 61 | Each time a new stream is started some initialization needs to be done. Thus the function 62 | initialize should be called to initialize everything. This initialize function will set 63 | the conversion factor as well as a multiplecation factor for volume. The volume only 64 | applies to the small and large filter. Since this filter uses a history of the audio data 65 | it is possible for it to vary in amplitude. This allows users to scale the data. This 66 | class will work on any number of channels. Once everything is specified then resample 67 | should be called as many times as is necessary to process all the data. The value 68 | inCount will be returned indicating how many inArray samples were actually used to 69 | produce the output. This value can be used to indicate where the next block of 70 | inArray data should start. The resample function is driven by the outCount value 71 | specified. The inArray should contain at least: 72 | outCount / factor + extra_samples. 73 | extra_samples depends on the type of filtering done. As a rule of thumb 50 should be 74 | adequate for any type of filter. 75 | */ 76 | 77 | class aflibData; 78 | 79 | class aflibConverter { 80 | 81 | public: 82 | 83 | // Available contructors and destructors 84 | aflibConverter ( 85 | bool high_quality, 86 | bool linear_interpolation, 87 | bool filter_interpolation); 88 | 89 | ~aflibConverter(); 90 | 91 | void 92 | initialize( 93 | double factor, /* factor = Sndout/Sndin */ 94 | int channels, /* number of sound channels */ 95 | double volume = 1.0); /* factor to multiply amplitude */ 96 | 97 | int 98 | resample( /* number of output samples returned */ 99 | int& inCount, /* number of input samples to convert */ 100 | int outCount, /* number of output samples to compute */ 101 | short inArray[], /* input array data (length inCount * nChans) */ 102 | short outArray[]);/* output array data (length outCount * nChans) */ 103 | 104 | 105 | private: 106 | 107 | aflibConverter(); 108 | 109 | aflibConverter(const aflibConverter& op); 110 | 111 | const aflibConverter& 112 | operator=(const aflibConverter& op); 113 | 114 | int 115 | err_ret(char *s); 116 | 117 | void 118 | deleteMemory(); 119 | 120 | int 121 | readData( 122 | int inCount, /* _total_ number of frames in input file */ 123 | short inArray[], /* input data */ 124 | short *outPtr[], /* array receiving chan samps */ 125 | int dataArraySize, /* size of these arrays */ 126 | int Xoff, /* read into input array starting at this index */ 127 | bool init_count); 128 | 129 | 130 | inline short 131 | WordToHword(int v, int scl) 132 | { 133 | short out; 134 | int llsb = (1<<(scl-1)); 135 | v += llsb; /* round */ 136 | v >>= scl; 137 | if (v>MAX_HWORD) { 138 | v = MAX_HWORD; 139 | } else if (v < MIN_HWORD) { 140 | v = MIN_HWORD; 141 | } 142 | out = (short) v; 143 | return out; 144 | }; 145 | 146 | int 147 | SrcLinear( 148 | short X[], 149 | short Y[], 150 | double factor, 151 | unsigned int *Time, 152 | unsigned short& Nx, 153 | unsigned short Nout); 154 | 155 | int 156 | SrcUp( 157 | short X[], 158 | short Y[], 159 | double factor, 160 | unsigned int *Time, 161 | unsigned short& Nx, 162 | unsigned short Nout, 163 | unsigned short Nwing, 164 | unsigned short LpScl, 165 | short Imp[], 166 | short ImpD[], 167 | bool Interp); 168 | 169 | int 170 | SrcUD( 171 | short X[], 172 | short Y[], 173 | double factor, 174 | unsigned int *Time, 175 | unsigned short& Nx, 176 | unsigned short Nout, 177 | unsigned short Nwing, 178 | unsigned short LpScl, 179 | short Imp[], 180 | short ImpD[], 181 | bool Interp); 182 | 183 | int 184 | FilterUp( 185 | short Imp[], 186 | short ImpD[], 187 | unsigned short Nwing, 188 | bool Interp, 189 | short *Xp, 190 | short Ph, 191 | short Inc); 192 | 193 | int 194 | FilterUD( 195 | short Imp[], 196 | short ImpD[], 197 | unsigned short Nwing, 198 | bool Interp, 199 | short *Xp, 200 | short Ph, 201 | short Inc, 202 | unsigned short dhb); 203 | 204 | int 205 | resampleFast( /* number of output samples returned */ 206 | int& inCount, /* number of input samples to convert */ 207 | int outCount, /* number of output samples to compute */ 208 | short inArray[], /* input array data (length inCount * nChans) */ 209 | short outArray[]);/* output array data (length outCount * nChans) */ 210 | 211 | int 212 | resampleWithFilter( /* number of output samples returned */ 213 | int& inCount, /* number of input samples to convert */ 214 | int outCount, /* number of output samples to compute */ 215 | short inArray[], /* input array data (length inCount * nChans) */ 216 | short outArray[], /* output array data (length outCount * nChans) */ 217 | short Imp[], short ImpD[], 218 | unsigned short LpScl, unsigned short Nmult, unsigned short Nwing); 219 | 220 | 221 | static short SMALL_FILTER_IMP[]; 222 | static short LARGE_FILTER_IMP[]; 223 | 224 | bool interpFilt; 225 | bool largeFilter; 226 | bool linearInterp; 227 | short ** _Xv; 228 | short ** _Yv; 229 | unsigned int _Time; 230 | double _factor; 231 | int _nChans; 232 | bool _initial; 233 | double _vol; 234 | 235 | }; 236 | 237 | 238 | #endif 239 | -------------------------------------------------------------------------------- /lib/JAMA/Makefile.am: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------ 2 | # 3 | # libofa -- the Open Fingerprint Architecture library 4 | # 5 | # Copyright (C) 2006 MusicIP Corporation 6 | # All rights reserved. 7 | # 8 | #------------------------------------------------------------------- 9 | EXTRA_DIST = jama_svd.h tnt_array1d.h tnt_array1d_utils.h tnt_array2d.h tnt_array2d_utils.h tnt_math_utils.h 10 | -------------------------------------------------------------------------------- /lib/JAMA/Makefile.in: -------------------------------------------------------------------------------- 1 | # Makefile.in generated by automake 1.8.5 from Makefile.am. 2 | # @configure_input@ 3 | 4 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 5 | # 2003, 2004 Free Software Foundation, Inc. 6 | # This Makefile.in is free software; the Free Software Foundation 7 | # gives unlimited permission to copy and/or distribute it, 8 | # with or without modifications, as long as this notice is preserved. 9 | 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 12 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 13 | # PARTICULAR PURPOSE. 14 | 15 | @SET_MAKE@ 16 | srcdir = @srcdir@ 17 | top_srcdir = @top_srcdir@ 18 | VPATH = @srcdir@ 19 | pkgdatadir = $(datadir)/@PACKAGE@ 20 | pkglibdir = $(libdir)/@PACKAGE@ 21 | pkgincludedir = $(includedir)/@PACKAGE@ 22 | top_builddir = ../.. 23 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 24 | INSTALL = @INSTALL@ 25 | install_sh_DATA = $(install_sh) -c -m 644 26 | install_sh_PROGRAM = $(install_sh) -c 27 | install_sh_SCRIPT = $(install_sh) -c 28 | INSTALL_HEADER = $(INSTALL_DATA) 29 | transform = $(program_transform_name) 30 | NORMAL_INSTALL = : 31 | PRE_INSTALL = : 32 | POST_INSTALL = : 33 | NORMAL_UNINSTALL = : 34 | PRE_UNINSTALL = : 35 | POST_UNINSTALL = : 36 | host_triplet = @host@ 37 | subdir = lib/JAMA 38 | DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 39 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 40 | am__aclocal_m4_deps = $(top_srcdir)/configure.in 41 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 42 | $(ACLOCAL_M4) 43 | mkinstalldirs = $(mkdir_p) 44 | CONFIG_HEADER = $(top_builddir)/config.h 45 | CONFIG_CLEAN_FILES = 46 | SOURCES = 47 | DIST_SOURCES = 48 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 49 | ACLOCAL = @ACLOCAL@ 50 | AMDEP_FALSE = @AMDEP_FALSE@ 51 | AMDEP_TRUE = @AMDEP_TRUE@ 52 | AMTAR = @AMTAR@ 53 | AR = @AR@ 54 | AUTOCONF = @AUTOCONF@ 55 | AUTOHEADER = @AUTOHEADER@ 56 | AUTOMAKE = @AUTOMAKE@ 57 | AWK = @AWK@ 58 | CC = @CC@ 59 | CCDEPMODE = @CCDEPMODE@ 60 | CFLAGS = @CFLAGS@ 61 | CPP = @CPP@ 62 | CPPFLAGS = @CPPFLAGS@ 63 | CURL_LIBS = @CURL_LIBS@ 64 | CXX = @CXX@ 65 | CXXCPP = @CXXCPP@ 66 | CXXDEPMODE = @CXXDEPMODE@ 67 | CXXFLAGS = @CXXFLAGS@ 68 | CYGPATH_W = @CYGPATH_W@ 69 | DARWIN_FALSE = @DARWIN_FALSE@ 70 | DARWIN_TRUE = @DARWIN_TRUE@ 71 | DEFS = @DEFS@ 72 | DEPDIR = @DEPDIR@ 73 | ECHO = @ECHO@ 74 | ECHO_C = @ECHO_C@ 75 | ECHO_N = @ECHO_N@ 76 | ECHO_T = @ECHO_T@ 77 | EGREP = @EGREP@ 78 | EXEEXT = @EXEEXT@ 79 | EXPAT_LIBS = @EXPAT_LIBS@ 80 | F77 = @F77@ 81 | FFLAGS = @FFLAGS@ 82 | FFTW3_FALSE = @FFTW3_FALSE@ 83 | FFTW3_TRUE = @FFTW3_TRUE@ 84 | FFT_WRAPPER = @FFT_WRAPPER@ 85 | FREEBSD_FALSE = @FREEBSD_FALSE@ 86 | FREEBSD_TRUE = @FREEBSD_TRUE@ 87 | INSTALL_DATA = @INSTALL_DATA@ 88 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ 89 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ 90 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 91 | LDFLAGS = @LDFLAGS@ 92 | LIBOBJS = @LIBOBJS@ 93 | LIBS = @LIBS@ 94 | LIBTOOL = @LIBTOOL@ 95 | LIBTOOL_DEPS = @LIBTOOL_DEPS@ 96 | LN_S = @LN_S@ 97 | LTLIBOBJS = @LTLIBOBJS@ 98 | MAINT = @MAINT@ 99 | MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ 100 | MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ 101 | MAKEINFO = @MAKEINFO@ 102 | OBJEXT = @OBJEXT@ 103 | PACKAGE = @PACKAGE@ 104 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ 105 | PACKAGE_NAME = @PACKAGE_NAME@ 106 | PACKAGE_STRING = @PACKAGE_STRING@ 107 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ 108 | PACKAGE_VERSION = @PACKAGE_VERSION@ 109 | PATH_SEPARATOR = @PATH_SEPARATOR@ 110 | PREFIX = @PREFIX@ 111 | RANLIB = @RANLIB@ 112 | SET_MAKE = @SET_MAKE@ 113 | SHELL = @SHELL@ 114 | STRIP = @STRIP@ 115 | VDSP_FALSE = @VDSP_FALSE@ 116 | VDSP_TRUE = @VDSP_TRUE@ 117 | VERSION = @VERSION@ 118 | ac_ct_AR = @ac_ct_AR@ 119 | ac_ct_CC = @ac_ct_CC@ 120 | ac_ct_CXX = @ac_ct_CXX@ 121 | ac_ct_F77 = @ac_ct_F77@ 122 | ac_ct_RANLIB = @ac_ct_RANLIB@ 123 | ac_ct_STRIP = @ac_ct_STRIP@ 124 | am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ 125 | am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ 126 | am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ 127 | am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 128 | am__include = @am__include@ 129 | am__leading_dot = @am__leading_dot@ 130 | am__quote = @am__quote@ 131 | bindir = @bindir@ 132 | build = @build@ 133 | build_alias = @build_alias@ 134 | build_cpu = @build_cpu@ 135 | build_os = @build_os@ 136 | build_vendor = @build_vendor@ 137 | datadir = @datadir@ 138 | exec_prefix = @exec_prefix@ 139 | host = @host@ 140 | host_alias = @host_alias@ 141 | host_cpu = @host_cpu@ 142 | host_os = @host_os@ 143 | host_vendor = @host_vendor@ 144 | includedir = @includedir@ 145 | infodir = @infodir@ 146 | install_sh = @install_sh@ 147 | libdir = @libdir@ 148 | libexecdir = @libexecdir@ 149 | localstatedir = @localstatedir@ 150 | mandir = @mandir@ 151 | mkdir_p = @mkdir_p@ 152 | oldincludedir = @oldincludedir@ 153 | prefix = @prefix@ 154 | program_transform_name = @program_transform_name@ 155 | sbindir = @sbindir@ 156 | sharedstatedir = @sharedstatedir@ 157 | sysconfdir = @sysconfdir@ 158 | target_alias = @target_alias@ 159 | 160 | # ------------------------------------------------------------------ 161 | # 162 | # libofa -- the Open Fingerprint Architecture library 163 | # 164 | # Copyright (C) 2006 MusicIP Corporation 165 | # All rights reserved. 166 | # 167 | #------------------------------------------------------------------- 168 | EXTRA_DIST = jama_svd.h tnt_array1d.h tnt_array1d_utils.h tnt_array2d.h tnt_array2d_utils.h tnt_math_utils.h 169 | all: all-am 170 | 171 | .SUFFIXES: 172 | $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) 173 | @for dep in $?; do \ 174 | case '$(am__configure_deps)' in \ 175 | *$$dep*) \ 176 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ 177 | && exit 0; \ 178 | exit 1;; \ 179 | esac; \ 180 | done; \ 181 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/JAMA/Makefile'; \ 182 | cd $(top_srcdir) && \ 183 | $(AUTOMAKE) --gnu lib/JAMA/Makefile 184 | .PRECIOUS: Makefile 185 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 186 | @case '$?' in \ 187 | *config.status*) \ 188 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ 189 | *) \ 190 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ 191 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 192 | esac; 193 | 194 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) 195 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 196 | 197 | $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) 198 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 199 | $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) 200 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 201 | 202 | mostlyclean-libtool: 203 | -rm -f *.lo 204 | 205 | clean-libtool: 206 | -rm -rf .libs _libs 207 | 208 | distclean-libtool: 209 | -rm -f libtool 210 | uninstall-info-am: 211 | tags: TAGS 212 | TAGS: 213 | 214 | ctags: CTAGS 215 | CTAGS: 216 | 217 | 218 | distdir: $(DISTFILES) 219 | @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ 220 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ 221 | list='$(DISTFILES)'; for file in $$list; do \ 222 | case $$file in \ 223 | $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ 224 | $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ 225 | esac; \ 226 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ 227 | dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ 228 | if test "$$dir" != "$$file" && test "$$dir" != "."; then \ 229 | dir="/$$dir"; \ 230 | $(mkdir_p) "$(distdir)$$dir"; \ 231 | else \ 232 | dir=''; \ 233 | fi; \ 234 | if test -d $$d/$$file; then \ 235 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ 236 | cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ 237 | fi; \ 238 | cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ 239 | else \ 240 | test -f $(distdir)/$$file \ 241 | || cp -p $$d/$$file $(distdir)/$$file \ 242 | || exit 1; \ 243 | fi; \ 244 | done 245 | check-am: all-am 246 | check: check-am 247 | all-am: Makefile 248 | installdirs: 249 | install: install-am 250 | install-exec: install-exec-am 251 | install-data: install-data-am 252 | uninstall: uninstall-am 253 | 254 | install-am: all-am 255 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am 256 | 257 | installcheck: installcheck-am 258 | install-strip: 259 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 260 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ 261 | `test -z '$(STRIP)' || \ 262 | echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install 263 | mostlyclean-generic: 264 | 265 | clean-generic: 266 | 267 | distclean-generic: 268 | -rm -f $(CONFIG_CLEAN_FILES) 269 | 270 | maintainer-clean-generic: 271 | @echo "This command is intended for maintainers to use" 272 | @echo "it deletes files that may require special tools to rebuild." 273 | clean: clean-am 274 | 275 | clean-am: clean-generic clean-libtool mostlyclean-am 276 | 277 | distclean: distclean-am 278 | -rm -f Makefile 279 | distclean-am: clean-am distclean-generic distclean-libtool 280 | 281 | dvi: dvi-am 282 | 283 | dvi-am: 284 | 285 | html: html-am 286 | 287 | info: info-am 288 | 289 | info-am: 290 | 291 | install-data-am: 292 | 293 | install-exec-am: 294 | 295 | install-info: install-info-am 296 | 297 | install-man: 298 | 299 | installcheck-am: 300 | 301 | maintainer-clean: maintainer-clean-am 302 | -rm -f Makefile 303 | maintainer-clean-am: distclean-am maintainer-clean-generic 304 | 305 | mostlyclean: mostlyclean-am 306 | 307 | mostlyclean-am: mostlyclean-generic mostlyclean-libtool 308 | 309 | pdf: pdf-am 310 | 311 | pdf-am: 312 | 313 | ps: ps-am 314 | 315 | ps-am: 316 | 317 | uninstall-am: uninstall-info-am 318 | 319 | .PHONY: all all-am check check-am clean clean-generic clean-libtool \ 320 | distclean distclean-generic distclean-libtool distdir dvi \ 321 | dvi-am html html-am info info-am install install-am \ 322 | install-data install-data-am install-exec install-exec-am \ 323 | install-info install-info-am install-man install-strip \ 324 | installcheck installcheck-am installdirs maintainer-clean \ 325 | maintainer-clean-generic mostlyclean mostlyclean-generic \ 326 | mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ 327 | uninstall-info-am 328 | 329 | # Tell versions [3.59,3.63) of GNU make to not export all variables. 330 | # Otherwise a system limit (for SysV at least) may be exceeded. 331 | .NOEXPORT: 332 | -------------------------------------------------------------------------------- /lib/JAMA/tnt_array1d.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Template Numerical Toolkit (TNT) 4 | * 5 | * Mathematical and Computational Sciences Division 6 | * National Institute of Technology, 7 | * Gaithersburg, MD USA 8 | * 9 | * 10 | * This software was developed at the National Institute of Standards and 11 | * Technology (NIST) by employees of the Federal Government in the course 12 | * of their official duties. Pursuant to title 17 Section 105 of the 13 | * United States Code, this software is not subject to copyright protection 14 | * and is in the public domain. NIST assumes no responsibility whatsoever for 15 | * its use by other parties, and makes no guarantees, expressed or implied, 16 | * about its quality, reliability, or any other characteristic. 17 | * 18 | */ 19 | 20 | 21 | 22 | #ifndef TNT_ARRAY1D_H 23 | #define TNT_ARRAY1D_H 24 | 25 | #include 26 | #include 27 | 28 | #ifdef TNT_BOUNDS_CHECK 29 | #include 30 | #endif 31 | 32 | namespace TNT 33 | { 34 | 35 | /** 36 | Tempplated one-dimensional, numerical array which 37 | looks like a conventional C array. 38 | Elements are accessed via the familiar A[i] notation. 39 | 40 |

41 | Array assignment is by reference (i.e. shallow assignment). 42 | That is, B=A implies that the A and B point to the 43 | same array, so modifications to the elements of A 44 | will be reflected in B. If an independent copy 45 | is required, then B = A.copy() can be used. Note 46 | that this facilitates returning arrays from functions 47 | without relying on compiler optimizations to eliminate 48 | extensive data copying. 49 | 50 |

51 | The indexing and layout of this array object makes 52 | it compatible with C and C++ algorithms that utilize 53 | the familiar C[i] notation. This includes numerous 54 | textbooks, such as Numercial Recipes, and various 55 | public domain codes. 56 | 57 |

58 | This class employs its own garbage collection via 59 | the use of reference counts. That is, whenever 60 | an internal array storage no longer has any references 61 | to it, it is destoryed. 62 | */ 63 | template 64 | class Array1D 65 | { 66 | 67 | 68 | private: 69 | T* v_; 70 | int n_; 71 | int *ref_count_; 72 | 73 | void initialize_(int n); 74 | void copy_(T* p, const T* q, int len) const; 75 | void set_(const T& val); 76 | void destroy_(); 77 | inline const T* begin_() const; 78 | inline T* begin_(); 79 | 80 | public: 81 | 82 | typedef T value_type; 83 | 84 | Array1D(); 85 | explicit Array1D(int n); 86 | Array1D(int n, T *a); 87 | Array1D(int n, const T &a); 88 | inline Array1D(const Array1D &A); 89 | inline Array1D & operator=(const T &a); 90 | inline Array1D & operator=(const Array1D &A); 91 | inline Array1D & ref(const Array1D &A); 92 | Array1D copy() const; 93 | Array1D & inject(const Array1D & A); 94 | inline T& operator[](int i); 95 | inline const T& operator[](int i) const; 96 | inline int dim1() const; 97 | inline int dim() const; 98 | inline int ref_count() const; 99 | ~Array1D(); 100 | 101 | 102 | }; 103 | 104 | /** 105 | Null constructor. Creates a 0-length (NULL) array. 106 | (Reference count is also zero.) 107 | */ 108 | 109 | template 110 | Array1D::Array1D() : v_(0), n_(0), ref_count_(0) 111 | { 112 | ref_count_ = new int; 113 | *ref_count_ = 1; 114 | } 115 | 116 | /** 117 | Copy constructor. Array data is NOT copied, but shared. 118 | Thus, in Array1D B(A), subsequent changes to A will 119 | be reflected in B. For an indepent copy of A, use 120 | Array1D B(A.copy()), or B = A.copy(), instead. 121 | */ 122 | template 123 | Array1D::Array1D(const Array1D &A) : v_(A.v_), 124 | n_(A.n_), ref_count_(A.ref_count_) 125 | { 126 | (*ref_count_)++; 127 | } 128 | 129 | 130 | 131 | /** 132 | Create a new array (vector) of length n, 133 | WIHOUT initializing array elements. 134 | To create an initialized array of constants, see Array1D(n,value). 135 | 136 |

137 | This version avoids the O(n) initialization overhead and 138 | is used just before manual assignment. 139 | 140 | @param n the dimension (length) of the new matrix. 141 | */ 142 | template 143 | Array1D::Array1D(int n) : v_(0), n_(n), ref_count_(0) 144 | { 145 | initialize_(n); 146 | ref_count_ = new int; 147 | *ref_count_ = 1; 148 | } 149 | 150 | 151 | 152 | /** 153 | Create a new array of length n, initializing array elements to 154 | constant specified by argument. Most often used to 155 | create an array of zeros, as in A(n, 0.0). 156 | 157 | @param n the dimension (length) of the new matrix. 158 | @param val the constant value to set all elements of the new array to. 159 | */ 160 | template 161 | Array1D::Array1D(int n, const T &val) : v_(0), n_(n) , 162 | ref_count_(0) 163 | { 164 | initialize_(n); 165 | set_(val); 166 | ref_count_ = new int; 167 | *ref_count_ = 1; 168 | 169 | } 170 | 171 | /** 172 | Create a new n-length array, as a view of an existing one-dimensional 173 | C array. (Note that the storage for this pre-existing array will 174 | never be destroyed by the Aray1DRef class.) 175 | 176 | @param n the dimension (length) of the new matrix. 177 | @param a the one dimensional C array to use as data storage for 178 | the array. 179 | */ 180 | template 181 | Array1D::Array1D(int n, T *a) : v_(a), n_(n) , 182 | ref_count_(0) 183 | { 184 | ref_count_ = new int; 185 | *ref_count_ = 2; /* this avoid destorying original data. */ 186 | 187 | } 188 | 189 | /** 190 | A[i] indexes the ith element of A. The first element is 191 | A[0]. If TNT_BOUNDS_CHECK is defined, then the index is 192 | checked that it falls within the array bounds. 193 | */ 194 | template 195 | inline T& Array1D::operator[](int i) 196 | { 197 | #ifdef TNT_BOUNDS_CHECK 198 | assert(i>= 0); 199 | assert(i < n_); 200 | #endif 201 | return v_[i]; 202 | } 203 | 204 | /** 205 | A[i] indexes the ith element of A. The first element is 206 | A[0]. If TNT_BOUNDS_CHECK is defined, then the index is 207 | checked that it fall within the array bounds. 208 | */ 209 | template 210 | inline const T& Array1D::operator[](int i) const 211 | { 212 | #ifdef TNT_BOUNDS_CHECK 213 | assert(i>= 0); 214 | assert(i < n_); 215 | #endif 216 | return v_[i]; 217 | } 218 | 219 | /** 220 | Assign all elemnts of A to a constant scalar. 221 | */ 222 | template 223 | Array1D & Array1D::operator=(const T &a) 224 | { 225 | set_(a); 226 | return *this; 227 | } 228 | /** 229 | Create a new of existing matrix. Used in B = A.copy() 230 | or in the construction of B, e.g. Array1D B(A.copy()), 231 | to create a new array that does not share data. 232 | 233 | */ 234 | template 235 | Array1D Array1D::copy() const 236 | { 237 | Array1D A( n_); 238 | copy_(A.begin_(), begin_(), n_); 239 | 240 | return A; 241 | } 242 | 243 | 244 | /** 245 | Copy the elements to from one array to another, in place. 246 | That is B.inject(A), both A and B must conform (i.e. have 247 | identical row and column dimensions). 248 | 249 | This differs from B = A.copy() in that references to B 250 | before this assignment are also affected. That is, if 251 | we have 252 |

253 | 	Array1D A(n);
254 | 	Array1D C(n);
255 | 	Array1D B(C);        // elements of B and C are shared. 
256 | 
257 | 
258 | then B.inject(A) affects both and C, while B=A.copy() creates 259 | a new array B which shares no data with C or A. 260 | 261 | @param A the array from which elements will be copied 262 | @return an instance of the modifed array. That is, in B.inject(A), 263 | it returns B. If A and B are not conformat, no modifications to 264 | B are made. 265 | 266 | */ 267 | template 268 | Array1D & Array1D::inject(const Array1D &A) 269 | { 270 | if (A.n_ == n_) 271 | copy_(begin_(), A.begin_(), n_); 272 | 273 | return *this; 274 | } 275 | 276 | 277 | 278 | 279 | 280 | /** 281 | Create a reference (shallow assignment) to another existing array. 282 | In B.ref(A), B and A shared the same data and subsequent changes 283 | to the array elements of one will be reflected in the other. 284 |

285 | This is what operator= calls, and B=A and B.ref(A) are equivalent 286 | operations. 287 | 288 | @return The new referenced array: in B.ref(A), it returns B. 289 | */ 290 | template 291 | Array1D & Array1D::ref(const Array1D &A) 292 | { 293 | if (this != &A) 294 | { 295 | (*ref_count_) --; 296 | if ( *ref_count_ < 1) 297 | { 298 | destroy_(); 299 | } 300 | 301 | n_ = A.n_; 302 | v_ = A.v_; 303 | ref_count_ = A.ref_count_; 304 | 305 | (*ref_count_) ++ ; 306 | 307 | } 308 | return *this; 309 | } 310 | 311 | /** 312 | B = A is shorthand notation for B.ref(A). 313 | */ 314 | template 315 | Array1D & Array1D::operator=(const Array1D &A) 316 | { 317 | return ref(A); 318 | } 319 | 320 | /** 321 | @return the dimension (number of elements) of the array. 322 | This is equivalent to dim() and dim1(). 323 | */ 324 | template 325 | inline int Array1D::dim1() const { return n_; } 326 | 327 | /** 328 | @return the dimension (number of elements) of the array. 329 | This is equivalent to dim1() and dim1(). 330 | */ 331 | template 332 | inline int Array1D::dim() const { return n_; } 333 | 334 | 335 | 336 | /** 337 | @return the number of arrays that share the same storage area 338 | as this one. (Must be at least one.) 339 | */ 340 | template 341 | inline int Array1D::ref_count() const 342 | { 343 | return *ref_count_; 344 | } 345 | 346 | template 347 | Array1D::~Array1D() 348 | { 349 | (*ref_count_) --; 350 | 351 | if (*ref_count_ < 1) 352 | destroy_(); 353 | } 354 | 355 | /* private internal functions */ 356 | 357 | template 358 | void Array1D::initialize_(int n) 359 | { 360 | 361 | 362 | v_ = new T[n]; 363 | n_ = n; 364 | } 365 | 366 | template 367 | void Array1D::set_(const T& a) 368 | { 369 | T *begin = &(v_[0]); 370 | T *end = begin+ n_; 371 | 372 | for (T* p=begin; p 378 | void Array1D::copy_(T* p, const T* q, int len) const 379 | { 380 | T *end = p + len; 381 | while (p 387 | void Array1D::destroy_() 388 | { 389 | 390 | if (v_ != 0) 391 | { 392 | delete[] (v_); 393 | } 394 | 395 | if (ref_count_ != 0) 396 | delete ref_count_; 397 | } 398 | 399 | /** 400 | @returns location of first element, i.e. A[0] (mutable). 401 | */ 402 | template 403 | const T* Array1D::begin_() const { return &(v_[0]); } 404 | 405 | /** 406 | @returns location of first element, i.e. A[0] (mutable). 407 | */ 408 | template 409 | T* Array1D::begin_() { return &(v_[0]); } 410 | 411 | 412 | 413 | 414 | } /* namespace TNT */ 415 | 416 | #endif 417 | /* TNT_ARRAY1D_H */ 418 | 419 | -------------------------------------------------------------------------------- /lib/JAMA/tnt_array1d_utils.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef TNT_ARRAY1D_UTILS_H 3 | #define TNT_ARRAY1D_UTILS_H 4 | 5 | #include 6 | #include 7 | 8 | namespace TNT 9 | { 10 | 11 | 12 | /** 13 | Write an array to a character outstream. Output format is one that can 14 | be read back in via the in-stream operator: one integer 15 | denoting the array dimension (n), followed by n elements, 16 | one per line. 17 | 18 | */ 19 | template 20 | std::ostream& operator<<(std::ostream &s, const Array1D &A) 21 | { 22 | int N=A.dim1(); 23 | 24 | s << N << "\n"; 25 | for (int j=0; j 40 | Note: the array being read into references new memory 41 | storage. If the intent is to fill an existing conformant 42 | array, use cin >> B; A.inject(B) ); 43 | instead or read the elements in one-a-time by hand. 44 | 45 | @param s the charater to read from (typically std::in) 46 | @param A the array to read into. 47 | */ 48 | template 49 | std::istream& operator>>(std::istream &s, Array1D &A) 50 | { 51 | int N; 52 | s >> N; 53 | 54 | Array1D B(N); 55 | for (int i=0; i> B[i]; 57 | A = B; 58 | return s; 59 | } 60 | 61 | 62 | 63 | } // namespace TNT 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /lib/JAMA/tnt_array2d.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Template Numerical Toolkit (TNT): Two-dimensional numerical array 4 | * 5 | * Mathematical and Computational Sciences Division 6 | * National Institute of Technology, 7 | * Gaithersburg, MD USA 8 | * 9 | * 10 | * This software was developed at the National Institute of Standards and 11 | * Technology (NIST) by employees of the Federal Government in the course 12 | * of their official duties. Pursuant to title 17 Section 105 of the 13 | * United States Code, this software is not subject to copyright protection 14 | * and is in the public domain. NIST assumes no responsibility whatsoever for 15 | * its use by other parties, and makes no guarantees, expressed or implied, 16 | * about its quality, reliability, or any other characteristic. 17 | * 18 | */ 19 | 20 | 21 | 22 | #ifndef TNT_ARRAY2D_H 23 | #define TNT_ARRAY2D_H 24 | 25 | #include 26 | #include 27 | #ifdef TNT_BOUNDS_CHECK 28 | #include 29 | #endif 30 | 31 | namespace TNT 32 | { 33 | 34 | /** 35 | Tempplated two-dimensional, numerical array which 36 | looks like a conventional C multiarray. 37 | Storage corresponds to C (row-major) ordering. 38 | Elements are accessed via A[i][j] notation. 39 | 40 |

41 | Array assignment is by reference (i.e. shallow assignment). 42 | That is, B=A implies that the A and B point to the 43 | same array, so modifications to the elements of A 44 | will be reflected in B. If an independent copy 45 | is required, then B = A.copy() can be used. Note 46 | that this facilitates returning arrays from functions 47 | without relying on compiler optimizations to eliminate 48 | extensive data copying. 49 | 50 |

51 | The indexing and layout of this array object makes 52 | it compatible with C and C++ algorithms that utilize 53 | the familiar C[i][j] notation. This includes numerous 54 | textbooks, such as Numercial Recipes, and various 55 | public domain codes. 56 | 57 |

58 | This class employs its own garbage collection via 59 | the use of reference counts. That is, whenever 60 | an internal array storage no longer has any references 61 | to it, it is destoryed. 62 | */ 63 | template 64 | class Array2D 65 | { 66 | 67 | 68 | private: 69 | T** v_; 70 | int m_; 71 | int n_; 72 | int *ref_count_; 73 | 74 | void initialize_(int m, int n); 75 | void copy_(T* p, const T* q, int len) const; 76 | void set_(const T& val); 77 | void destroy_(); 78 | inline const T* begin_() const; 79 | inline T* begin_(); 80 | 81 | public: 82 | 83 | typedef T value_type; 84 | 85 | Array2D(); 86 | Array2D(int m, int n); 87 | Array2D(int m, int n, T *a); 88 | Array2D(int m, int n, const T &a); 89 | inline Array2D(const Array2D &A); 90 | inline Array2D & operator=(const T &a); 91 | inline Array2D & operator=(const Array2D &A); 92 | inline Array2D & ref(const Array2D &A); 93 | Array2D copy() const; 94 | Array2D & inject(const Array2D & A); 95 | inline T* operator[](int i); 96 | inline const T* operator[](int i) const; 97 | inline int dim1() const; 98 | inline int dim2() const; 99 | inline int ref_count() const; 100 | ~Array2D(); 101 | inline void deleteObj(); 102 | 103 | 104 | }; 105 | 106 | 107 | /** 108 | Copy constructor. Array data is NOT copied, but shared. 109 | Thus, in Array2D B(A), subsequent changes to A will 110 | be reflected in B. For an indepent copy of A, use 111 | Array2D B(A.copy()), or B = A.copy(), instead. 112 | */ 113 | template 114 | Array2D::Array2D(const Array2D &A) : v_(A.v_), m_(A.m_), 115 | n_(A.n_), ref_count_(A.ref_count_) 116 | { 117 | (*ref_count_)++; 118 | } 119 | 120 | 121 | 122 | /** 123 | Create a new (m x n) array, WIHOUT initializing array elements. 124 | To create an initialized array of constants, see Array2D(m,n,value). 125 | 126 |

127 | This version avoids the O(m*n) initialization overhead and 128 | is used just before manual assignment. 129 | 130 | @param m the first (row) dimension of the new matrix. 131 | @param n the second (column) dimension of the new matrix. 132 | */ 133 | template 134 | Array2D::Array2D(int m, int n) : v_(0), m_(m), n_(n), ref_count_(0) 135 | { 136 | initialize_(m,n); 137 | ref_count_ = new int; 138 | *ref_count_ = 1; 139 | } 140 | 141 | 142 | 143 | /** 144 | Create a new (m x n) array, initializing array elements to 145 | constant specified by argument. Most often used to 146 | create an array of zeros, as in A(m, n, 0.0). 147 | 148 | @param m the first (row) dimension of the new matrix. 149 | @param n the second (column) dimension of the new matrix. 150 | @param val the constant value to set all elements of the new array to. 151 | */ 152 | template 153 | Array2D::Array2D(int m, int n, const T &val) : v_(0), m_(m), n_(n) , 154 | ref_count_(0) 155 | { 156 | initialize_(m,n); 157 | set_(val); 158 | ref_count_ = new int; 159 | *ref_count_ = 1; 160 | 161 | } 162 | 163 | /** 164 | Create a new (m x n) array, as a view of an existing one-dimensional 165 | array stored in C order, i.e. right-most dimension varying fastest. 166 | (Often referred to as "row-major" ordering.) 167 | Note that the storage for this pre-existing array will 168 | never be garbage collected by the Array2D class. 169 | 170 | @param m the first (row) dimension of the new matrix. 171 | @param n the second (column) dimension of the new matrix. 172 | @param a the one dimensional C array to use as data storage for 173 | the array. 174 | */ 175 | template 176 | Array2D::Array2D(int m, int n, T *a) : v_(0), m_(m), n_(n) , 177 | ref_count_(0) 178 | { 179 | T* p = a; 180 | v_ = new T*[m]; 181 | for (int i=0; i 204 | inline T* Array2D::operator[](int i) 205 | { 206 | #ifdef TNT_BOUNDS_CHECK 207 | assert(i >= 0); 208 | assert(i < m_); 209 | #endif 210 | 211 | return v_[i]; 212 | 213 | } 214 | 215 | template 216 | inline const T* Array2D::operator[](int i) const { return v_[i]; } 217 | 218 | /** 219 | Assign all elemnts of A to a constant scalar. 220 | */ 221 | template 222 | Array2D & Array2D::operator=(const T &a) 223 | { 224 | set_(a); 225 | return *this; 226 | } 227 | /** 228 | Create a new of existing matrix. Used in B = A.copy() 229 | or in the construction of B, e.g. Array2D B(A.copy()), 230 | to create a new array that does not share data. 231 | 232 | */ 233 | template 234 | Array2D Array2D::copy() const 235 | { 236 | Array2D A(m_, n_); 237 | copy_(A.begin_(), begin_(), m_*n_); 238 | 239 | return A; 240 | } 241 | 242 | 243 | /** 244 | Copy the elements to from one array to another, in place. 245 | That is B.inject(A), both A and B must conform (i.e. have 246 | identical row and column dimensions). 247 | 248 | This differs from B = A.copy() in that references to B 249 | before this assignment are also affected. That is, if 250 | we have 251 |

252 | 	Array2D A(m,n);
253 | 	Array2D C(m,n);
254 | 	Array2D B(C);        // elements of B and C are shared. 
255 | 
256 | 
257 | then B.inject(A) affects both and C, while B=A.copy() creates 258 | a new array B which shares no data with C or A. 259 | 260 | @param A the array from elements will be copied 261 | @return an instance of the modifed array. That is, in B.inject(A), 262 | it returns B. If A and B are not conformat, no modifications to 263 | B are made. 264 | 265 | */ 266 | template 267 | Array2D & Array2D::inject(const Array2D &A) 268 | { 269 | if (A.m_ == m_ && A.n_ == n_) 270 | copy_(begin_(), A.begin_(), m_*n_); 271 | 272 | return *this; 273 | } 274 | 275 | 276 | 277 | 278 | 279 | /** 280 | Create a reference (shallow assignment) to another existing array. 281 | In B.ref(A), B and A shared the same data and subsequent changes 282 | to the array elements of one will be reflected in the other. 283 |

284 | This is what operator= calls, and B=A and B.ref(A) are equivalent 285 | operations. 286 | 287 | @return The new referenced array: in B.ref(A), it returns B. 288 | */ 289 | template 290 | Array2D & Array2D::ref(const Array2D &A) 291 | { 292 | if (this != &A) 293 | { 294 | (*ref_count_) --; 295 | if ( *ref_count_ < 1 ) 296 | { 297 | destroy_(); 298 | } 299 | 300 | m_ = A.m_; 301 | n_ = A.n_; 302 | v_ = A.v_; 303 | ref_count_ = A.ref_count_; 304 | 305 | (*ref_count_) ++ ; 306 | 307 | } 308 | return *this; 309 | } 310 | 311 | /** 312 | B = A is shorthand notation for B.ref(A). 313 | */ 314 | template 315 | Array2D & Array2D::operator=(const Array2D &A) 316 | { 317 | return ref(A); 318 | } 319 | 320 | /** 321 | @return the size of the first dimension of the array, i.e. 322 | the number of rows. 323 | */ 324 | template 325 | inline int Array2D::dim1() const { return m_; } 326 | 327 | /** 328 | @return the size of the second dimension of the array, i.e. 329 | the number of columns. 330 | */ 331 | template 332 | inline int Array2D::dim2() const { return n_; } 333 | 334 | 335 | /** 336 | @return the number of arrays that share the same storage area 337 | as this one. (Must be at least one.) 338 | */ 339 | template 340 | inline int Array2D::ref_count() const 341 | { 342 | return *ref_count_; 343 | } 344 | 345 | template 346 | Array2D::~Array2D() 347 | { 348 | if (ref_count_ != 0) 349 | { 350 | (*ref_count_) --; 351 | 352 | if (*ref_count_ < 1) 353 | destroy_(); 354 | } 355 | 356 | } 357 | 358 | /* private internal functions */ 359 | 360 | template 361 | void Array2D::initialize_(int m, int n) 362 | { 363 | 364 | 365 | T* p = new T[m*n]; 366 | v_ = new T*[m]; 367 | for (int i=0; i 377 | void Array2D::set_(const T& a) 378 | { 379 | T *begin = &v_[0][0]; 380 | T *end = begin+ m_*n_; 381 | 382 | for (T* p=begin; p 388 | void Array2D::copy_(T* p, const T* q, int len) const 389 | { 390 | T *end = p + len; 391 | while (p 397 | void Array2D::destroy_() 398 | { 399 | 400 | if (v_ != 0) 401 | { 402 | delete[] (v_[0]); 403 | delete[] (v_); 404 | } 405 | 406 | if (ref_count_ != 0) 407 | delete ref_count_; 408 | } 409 | 410 | template 411 | void Array2D::deleteObj() 412 | { 413 | 414 | if (v_ != 0) 415 | { 416 | delete[] (v_); 417 | } 418 | 419 | if (ref_count_ != 0) 420 | { 421 | delete ref_count_; 422 | ref_count_ = 0; 423 | } 424 | } 425 | 426 | /** 427 | @returns location of first element, i.e. A[0][0] (mutable). 428 | */ 429 | template 430 | const T* Array2D::begin_() const { return &(v_[0][0]); } 431 | 432 | /** 433 | @returns location of first element, i.e. A[0][0] (mutable). 434 | */ 435 | template 436 | T* Array2D::begin_() { return &(v_[0][0]); } 437 | 438 | /** 439 | Create a null (0x0) array. 440 | */ 441 | template 442 | Array2D::Array2D() : v_(0), m_(0), n_(0) 443 | { 444 | ref_count_ = new int; 445 | *ref_count_ = 1; 446 | } 447 | 448 | 449 | 450 | 451 | 452 | } /* namespace TNT */ 453 | 454 | #endif 455 | /* TNT_ARRAY2D_H */ 456 | 457 | -------------------------------------------------------------------------------- /lib/JAMA/tnt_array2d_utils.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef TNT_ARRAY2D_UTILS_H 4 | #define TNT_ARRAY2D_UTILS_H 5 | 6 | #include 7 | #include 8 | 9 | namespace TNT 10 | { 11 | 12 | 13 | /** 14 | Write an array to a character outstream. Output format is one that can 15 | be read back in via the in-stream operator: two integers 16 | denoting the array dimensions (m x n), followed by m 17 | lines of n elements. 18 | 19 | */ 20 | template 21 | std::ostream& operator<<(std::ostream &s, const Array2D &A) 22 | { 23 | int M=A.dim1(); 24 | int N=A.dim2(); 25 | 26 | s << M << " " << N << "\n"; 27 | 28 | for (int i=0; i 49 | Note: the array being read into references new memory 50 | storage. If the intent is to fill an existing conformant 51 | array, use cin >> B; A.inject(B) ); 52 | instead or read the elements in one-a-time by hand. 53 | 54 | @param s the charater to read from (typically std::in) 55 | @param A the array to read into. 56 | */ 57 | template 58 | std::istream& operator>>(std::istream &s, Array2D &A) 59 | { 60 | 61 | int M, N; 62 | 63 | s >> M >> N; 64 | 65 | Array2D B(M,N); 66 | 67 | for (int i=0; i> B[i][j]; 71 | } 72 | 73 | A = B; 74 | return s; 75 | } 76 | 77 | 78 | /** 79 | Matrix Multiply: compute C = A*B, where C[i][j] 80 | is the dot-product of row i of A and column j of B. 81 | 82 | 83 | @param A an (m x n) array 84 | @param B an (n x k) array 85 | @return the (m x k) array A*B, or a null array (0x0) 86 | if the matrices are non-conformant (i.e. the number 87 | of columns of A are different than the number of rows of B.) 88 | 89 | 90 | */ 91 | template 92 | Array2D matmult(const Array2D &A, const Array2D &B) 93 | { 94 | if (A.dim2() != B.dim1()) 95 | return Array2D(); 96 | 97 | int M = A.dim1(); 98 | int N = A.dim2(); 99 | int K = B.dim2(); 100 | 101 | Array2D C(M,K); 102 | 103 | for (int i=0; i 5 | /* needed for sqrt() below */ 6 | 7 | #ifdef PREANSI 8 | template 9 | inline const _Tp& min(const _Tp& __a, const _Tp& __b) { 10 | return __b < __a ? __b : __a; 11 | } 12 | 13 | template 14 | inline const _Tp& max(const _Tp& __a, const _Tp& __b) { 15 | return __a < __b ? __b : __a; 16 | } 17 | #endif 18 | 19 | 20 | namespace TNT 21 | { 22 | /** 23 | @returns the absolute value of a real (no-complex) scalar. 24 | */ 25 | template 26 | Real abs(const Real &a) 27 | { 28 | return (a > 0 ? a : -a); 29 | } 30 | 31 | /** 32 | @returns hypotenuse of real (non-complex) scalars a and b by 33 | avoiding underflow/overflow 34 | using (a * sqrt( 1 + (b/a) * (b/a))), rather than 35 | sqrt(a*a + b*b). 36 | */ 37 | template 38 | Real hypot(const Real &a, const Real &b) 39 | { 40 | if (a== 0) 41 | { 42 | return abs(b); 43 | } 44 | else 45 | { 46 | Real c = b/a; 47 | return a * sqrt(1 + c*c); 48 | } 49 | } 50 | 51 | /** 52 | @returns the minimum of scalars a and b. 53 | template 54 | Scalar min(const Scalar &a, const Scalar &b) 55 | { 56 | return a < b ? a : b; 57 | } 58 | */ 59 | 60 | /** 61 | @returns the maximum of scalars a and b. 62 | template 63 | Scalar max(const Scalar &a, const Scalar &b) 64 | { 65 | return a > b ? a : b; 66 | } 67 | */ 68 | } 69 | #endif 70 | /* MATH_UTILS_H */ 71 | -------------------------------------------------------------------------------- /lib/Makefile.am: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------ 2 | # 3 | # libofa -- the Open Fingerprint Architecture library 4 | # 5 | # Copyright (C) 2006 MusicIP Corporation 6 | # All rights reserved. 7 | # 8 | #------------------------------------------------------------------- 9 | AUTOMAKE_OPTIONS = foreign 10 | 11 | SUBDIRS = JAMA AFLIB 12 | 13 | lib_LTLIBRARIES = libofa.la 14 | INCLUDES = -I$(top_srcdir)/include 15 | 16 | if VDSP 17 | dist_libofa_la_SOURCES = fftlibvdsp_op.cpp fft_op.cpp frametracker_op.cpp \ 18 | mainprint.cpp signal_op.cpp trackdata_op.cpp trackframe_op.cpp \ 19 | tracklist_op.cpp 20 | else 21 | dist_libofa_la_SOURCES = fftlibw3_op.cpp fft_op.cpp frametracker_op.cpp \ 22 | mainprint.cpp signal_op.cpp trackdata_op.cpp trackframe_op.cpp \ 23 | tracklist_op.cpp 24 | endif 25 | 26 | # Here are a set of rules to help you update your library version information: 27 | # Scheme: current:revsion:age 28 | # 1. Start with version information of `0:0:0' for each libtool library. 29 | # 2. Update the version information only immediately before a public release 30 | # of your software. More frequent updates are unnecessary, and only 31 | # guarantee that the current interface number gets larger faster. 32 | # 3. If the library source code has changed at all since the last update, 33 | # then increment revision (`c:r:a' becomes `c:r+1:a'). 34 | # 4. If any interfaces have been added, removed, or changed since the last 35 | # update, increment current, and set revision to 0. 36 | # 5. If any interfaces have been added since the last public release, then 37 | # increment age. 38 | # 6. If any interfaces have been removed since the last public release, then 39 | # set age to 0. 40 | libofa_la_LDFLAGS = -version-info 0:0:0 -no-undefined 41 | libofa_la_LIBADD = AFLIB/libaflib.la -lm 42 | 43 | noinst_HEADERS = error_op.h fftlib_op.h fft_op.h frametracker_op.h signal_op.h \ 44 | trackdata_op.h trackframe_op.h tracklist_op.h 45 | -------------------------------------------------------------------------------- /lib/error_op.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | 3 | libofa -- the Open Fingerprint Architecture library 4 | 5 | Copyright (C) 2006 MusicIP Corporation 6 | All rights reserved. 7 | 8 | -------------------------------------------------------------------*/ 9 | // FILE: "error_op.h" 10 | // MODULE: Header for error object OnePrintError. Client can catch or ignore. 11 | // AUTHOR: Frode Holm 12 | // DATE CREATED: 1/12/06 13 | 14 | #ifndef ERR_H_OP 15 | #define ERR_H_OP 1 16 | 17 | #include 18 | using namespace std; 19 | 20 | const int NOFLCODE = -1; 21 | const int SILENCEONLY = 1; 22 | const int GENERALFAILURE = 2; 23 | const int FILETOOSHORT = 10; 24 | 25 | 26 | class OnePrintError { 27 | public: 28 | OnePrintError(string s) { Mes = s; ErrorCode = NOFLCODE; } 29 | OnePrintError(string s, int code) { Mes = s; ErrorCode = code; } 30 | OnePrintError(const int code) { ErrorCode = code; } 31 | string GetMessage() { return Mes; } 32 | long GetErrorCode() { return ErrorCode; } 33 | void SetErrorCode(const int code) { ErrorCode = code; } 34 | private: 35 | string Mes; 36 | int ErrorCode; 37 | }; 38 | 39 | 40 | 41 | #endif 42 | 43 | -------------------------------------------------------------------------------- /lib/fft_op.cpp: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | 3 | libofa -- the Open Fingerprint Architecture library 4 | 5 | Copyright (C) 2006 MusicIP Corporation 6 | All rights reserved. 7 | 8 | -------------------------------------------------------------------*/ 9 | // FILE: "fft_op.cpp" 10 | // MODULE: Implementation for class FFT_op 11 | // AUTHOR: Frode Holm 12 | // DATE CREATED: 1/12/06 13 | 14 | #include 15 | #include 16 | #include "ofa1/ofa.h" 17 | #include "fft_op.h" 18 | #include "error_op.h" 19 | 20 | #define ROUND(x) ((x>0)? (long)floor(x + 0.5) : (long)(ceil(x - 0.5)) ) 21 | 22 | FFT_op::FFT_op() 23 | { 24 | FrameSize = 0; 25 | NumBins = 0; 26 | NumFrames = 0; 27 | TimeSpectra = 0; 28 | BufSize = 0; 29 | OutBuf = 0; 30 | InBuf = 0; 31 | AmpSpectWin = 0; 32 | Hamming = 0; 33 | Overlap = 0; 34 | Rate = 0; 35 | } 36 | 37 | FFT_op::~FFT_op() 38 | { 39 | FFTLib_op::Destroy(); 40 | 41 | if (OutBuf) 42 | delete[] OutBuf; 43 | if (InBuf) 44 | delete[] InBuf; 45 | if (AmpSpectWin) 46 | delete[] AmpSpectWin; 47 | if (TimeSpectra) 48 | delete[] TimeSpectra; 49 | if (Hamming) 50 | delete[] Hamming; 51 | } 52 | 53 | 54 | void 55 | FFT_op::LoadSignal(Signal_op *sig) 56 | { 57 | Signal = sig; 58 | Rate = Signal->GetRate(); 59 | 60 | if (TimeSpectra) 61 | { 62 | delete[] TimeSpectra; 63 | TimeSpectra = 0; 64 | } 65 | } 66 | 67 | 68 | void 69 | FFT_op::SetSize(int N, bool optimize) 70 | { 71 | 72 | if (OutBuf) 73 | delete[] OutBuf; 74 | if (InBuf) 75 | delete[] InBuf; 76 | if (AmpSpectWin) 77 | delete[] AmpSpectWin; 78 | FrameSize = N; 79 | OutBuf = new double[FrameSize+128]; 80 | InBuf = new double[FrameSize+128]; 81 | FFTLib_op::SetSize(N, optimize, InBuf, OutBuf); 82 | SetNumBins(FrameSize/2 + 1); 83 | AmpSpectWin = new double[GetNumBins()]; 84 | WindowInit(); 85 | } 86 | 87 | void 88 | FFT_op::SetStep(int step) { 89 | if (Rate==0) 90 | throw OnePrintError("SetStep:programming error:Rate"); 91 | if (step<=0) 92 | throw OnePrintError("SetStep:programming error:Step"); 93 | 94 | StepSize = step; 95 | } 96 | 97 | 98 | void 99 | FFT_op::WindowInit() 100 | { 101 | if (Hamming) 102 | delete[] Hamming; 103 | 104 | Hamming = new double[FrameSize]; 105 | for (int i=0; iGetLength()-FrameSize) / StepSize) + 1); 141 | CreateBuffer(GetNumBins(), GetNumFrames()); // allocates spectrum storage 142 | } 143 | 144 | short* sdata = Signal->GetBuffer(); 145 | j = BufSize; // safety 146 | 147 | // m counts # of StepSize's we've made 148 | for (i=0, m=0; i<=Signal->GetLength()-FrameSize; i+=StepSize, m++) 149 | { 150 | for (j=0; j halfFreq/(nBins/2) || nBins>=GetNumBins()) 211 | throw OnePrintError("Oversampling not supported in ReSample"); 212 | 213 | int j; 214 | float* fr; 215 | int srcInd, curInd; 216 | double fStep, maxAmp, curHz, srcHz; 217 | 218 | // Pre-calculate frequencies 219 | vector freq(GetNumBins()); 220 | for (j=0; j maxAmp) maxAmp = fr[srcInd]; 241 | srcInd++; 242 | srcHz = freq[srcInd]; 243 | } 244 | tmpBuf[i*nBins+j] = (float)maxAmp; 245 | } 246 | 247 | fStep = (hiFreq-halfFreq)/(nBins/2); 248 | for (j=nBins/2; j maxAmp) maxAmp = fr[srcInd]; 255 | srcInd++; 256 | srcHz = freq[srcInd]; 257 | } 258 | tmpBuf[i*nBins+j] = (float)maxAmp; 259 | } 260 | } 261 | 262 | delete[] TimeSpectra; 263 | TimeSpectra = tmpBuf; 264 | SetNumBins(nBins); 265 | BufSize = GetNumFrames() * GetNumBins(); 266 | } 267 | 268 | 269 | // convert Hz to MIDI note number. 270 | int 271 | FFT_op::FreqToMidi(double hz) 272 | { 273 | const double nFact = 17.31234049067; // 12/ln(2) 274 | double Nd; 275 | 276 | Nd = nFact*log(hz/27.5); 277 | 278 | return ROUND(Nd); 279 | } 280 | 281 | -------------------------------------------------------------------------------- /lib/fft_op.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | 3 | libofa -- the Open Fingerprint Architecture library 4 | 5 | Copyright (C) 2006 MusicIP Corporation 6 | All rights reserved. 7 | 8 | -------------------------------------------------------------------*/ 9 | // FILE: "fft_op.h" 10 | // MODULE: Class header for FFT_op 11 | // AUTHOR: Frode Holm 12 | // DATE CREATED: 1/12/06 13 | 14 | #ifndef __FFT_OP_H 15 | #define __FFT_OP_H 1 16 | 17 | #ifdef WIN32 18 | #include "../config_win32.h" 19 | #else 20 | #include "../config.h" 21 | #endif 22 | #include "signal_op.h" 23 | #include "fftlib_op.h" 24 | 25 | enum { RECTANGULAR, TRIANGULAR, HAMMING }; 26 | const double TwoPI = 2.0 * 3.14159265358979324; 27 | 28 | class FFT_op : public FFTLib_op { 29 | public: 30 | FFT_op(); 31 | ~FFT_op(); 32 | void LoadSignal(Signal_op *sig); 33 | void SetSize(int N, bool optimize); 34 | void Compute(double ovlap); 35 | void SetWindowShape(int shape) { WindowShape = shape; } 36 | void ReSample(int nBins, bool melScale); 37 | long GetNumFrames() const { return NumFrames; } 38 | int GetNumBins() const { return NumBins; } 39 | float* GetFrame(int frNum) { return &TimeSpectra[frNum * NumBins]; } 40 | double GetFreqStep() { return (double)Rate/(GetNumBins()*2); } 41 | double GetStepDur() const { return StepSize * 1000.0 / Rate; } 42 | static int FreqToMidi(double hz); 43 | private: 44 | void CreateBuffer(int numBins, int numFrames, bool init = false); 45 | void SetStep(int step); 46 | void WindowInit(); 47 | void ComputeWindow(double* in); 48 | void SetNumFrames(long numFr) { NumFrames = numFr; } 49 | void SetNumBins(int bins) { NumBins = bins; } 50 | double GetFreq(int step) { return step * GetFreqStep(); } 51 | 52 | Signal_op* Signal; 53 | double* InBuf; // Temporary holding buffer for fft input frames 54 | double* OutBuf; // Temporary output buffer for one FFT frame 55 | double* AmpSpectWin; // Buffer for amplitude spectrum of current frame 56 | float* TimeSpectra; // Sequence of amp spectra for Signal, separated by NumBins 57 | long BufSize; // Size of TimeSpectra buffer 58 | int FrameSize; // in # of signal sample points 59 | int StepSize; // in # of signal sample points 60 | int NumBins; // # of spectrum points 61 | int NumFrames; // # of analysis frames 62 | int Rate; // Sample rate 63 | double Overlap; // in percent (= 1 - StepSize/FrameSize) 64 | int WindowShape; // Type of windowing 65 | double* Hamming; // Hamming window 66 | 67 | }; 68 | 69 | 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /lib/fftlib_op.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | 3 | libofa -- the Open Fingerprint Architecture library 4 | 5 | Copyright (C) 2006 MusicIP Corporation 6 | All rights reserved. 7 | 8 | -------------------------------------------------------------------*/ 9 | // FILE: "fftlib_op.h" 10 | // MODULE: Generic wrapper class for external FFT library calls 11 | // AUTHOR: Frode Holm 12 | // DATE CREATED: 1/12/06 13 | 14 | 15 | #ifndef __FFTLIB_OP_H 16 | #define __FFTLIB_OP_H 1 17 | 18 | 19 | #ifdef FFTW 20 | #include "rfftw.h" 21 | 22 | class FFTLib_op { 23 | protected: 24 | FFTLib_op() { PlanF = 0; } 25 | void Initialize(int N, bool optimize); 26 | void Destroy(); 27 | void SetSize(int N, bool optimize, double *in, double *out); 28 | void ComputeFrame(int N, double *in, double *out); 29 | 30 | rfftw_plan PlanF; // Forward plan: real to complex (time to frequency) 31 | }; 32 | #endif 33 | 34 | #ifdef FFTW3 35 | #include "fftw3.h" 36 | 37 | class FFTLib_op { 38 | protected: 39 | FFTLib_op() { PlanF = 0; } 40 | void Initialize(int N, bool optimize); 41 | void Destroy(); 42 | void SetSize(int N, bool optimize, double *in, double *out); 43 | void ComputeFrame(int N, double *in, double *out); 44 | 45 | unsigned Flags; 46 | 47 | fftw_plan PlanF; // Forward plan: real to complex (time to frequency) 48 | }; 49 | #endif 50 | 51 | 52 | #ifdef MKL 53 | 54 | class FFTLib_op { 55 | protected: 56 | FFTLib_op() { WSave = 0; } 57 | void Initialize(int N, bool optimize); 58 | void Destroy(); 59 | void SetSize(int N, bool optimize, double *in, double *out); 60 | void ComputeFrame(int N, double *in, double *out); 61 | 62 | double* WSave; 63 | }; 64 | #endif 65 | 66 | #ifdef VDSP 67 | #include 68 | 69 | class FFTLib_op { 70 | protected: 71 | FFTLib_op() { Init = false; } 72 | void Initialize(int N, bool optimize); 73 | void Destroy(); 74 | void SetSize(int N, bool optimize, double *in, double *out); 75 | void ComputeFrame(int N, double *in, double *out); 76 | private: 77 | FFTSetupD SetupReal; 78 | DSPDoubleSplitComplex A; 79 | int Exp; 80 | bool Init; 81 | }; 82 | #endif 83 | 84 | 85 | #endif 86 | 87 | -------------------------------------------------------------------------------- /lib/fftlibvdsp_op.cpp: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | 3 | libofa -- the Open Fingerprint Architecture library 4 | 5 | Copyright (C) 2006 MusicIP Corporation 6 | All rights reserved. 7 | 8 | -------------------------------------------------------------------*/ 9 | // FILE: "fftlibvdsp_op.cpp" 10 | // MODULE: Wrapper for Mac vDSP library calls 11 | // AUTHOR: Frode Holm 12 | // DATE CREATED: 1/12/06 13 | 14 | #include "../config.h" 15 | #include "fftlib_op.h" 16 | 17 | 18 | void 19 | FFTLib_op::Initialize(int N, bool optimize) 20 | { 21 | Exp = (int) log2(N); 22 | if (Init) 23 | { 24 | delete[] A.realp; 25 | delete[] A.imagp; 26 | vDSP_destroy_fftsetupD(SetupReal); 27 | } 28 | 29 | A.realp = new double[ N/2]; 30 | A.imagp = new double[ N/2]; 31 | SetupReal = vDSP_create_fftsetupD(Exp, 0); 32 | Init = true; 33 | } 34 | 35 | void 36 | FFTLib_op::Destroy() 37 | { 38 | } 39 | 40 | void 41 | FFTLib_op::SetSize(int N, bool optimize, double *in, double *out) 42 | { 43 | Initialize(N, optimize); 44 | } 45 | 46 | void 47 | FFTLib_op::ComputeFrame(int N, double *in, double *out) 48 | { 49 | vDSP_ctozD ((DSPDoubleComplex*) in, 2, &A, 1, N/2 ); 50 | 51 | vDSP_fft_zripD(SetupReal, &A, 1, Exp, FFT_FORWARD); 52 | 53 | int i,j; 54 | for (i=0; i 15 | #include "frametracker_op.h" 16 | #include "trackdata_op.h" 17 | 18 | // Constructor 19 | 20 | FrameTracker_op::FrameTracker_op(float peakT, float fThresh, float lenT, int maxTrax) 21 | { 22 | PeakThreshold = peakT; 23 | FreqThreshold = fThresh; 24 | LengthThreshold = lenT; 25 | MaxTracks = maxTrax; 26 | PeakWidth = 2; // width of peak interval (on one side) 27 | BaseFr = 0; 28 | } 29 | 30 | // Destructor 31 | 32 | FrameTracker_op::~FrameTracker_op() 33 | { 34 | BaseFr = 0; 35 | } 36 | 37 | 38 | void 39 | FrameTracker_op::Compute(FFT_op& spectra) 40 | { 41 | double sdur = spectra.GetStepDur(); 42 | 43 | int numFrames = spectra.GetNumFrames(); 44 | 45 | // Detect the peaks in each frame 46 | for (int i = 0; i < numFrames; i++) 47 | { 48 | float realTime = (float)(i * sdur); 49 | TrackFrame_op* thePeaks = new TrackFrame_op(realTime); 50 | 51 | FindPeaks(spectra, i, thePeaks); 52 | Tracks.Add(thePeaks); // add the frame to the track list 53 | } 54 | 55 | TrackPeaks(); // Track the peaks between frames 56 | ContinuePeaks(); // Try to extend the tracks 57 | } 58 | 59 | // Find the peaks in a single frame; 60 | // use local-max detection over the min threshold 61 | void 62 | FrameTracker_op::FindPeaks(FFT_op& data, int frameNum, TrackFrame_op* thePeaks) 63 | { 64 | 65 | int numBins = data.GetNumBins(); 66 | float* frame = data.GetFrame(frameNum); 67 | int npeak = 0; 68 | double realTime = frameNum * data.GetStepDur(); 69 | TrackData_op* prevP = 0; 70 | float prevPV = * frame++; // previous previous sample 71 | float prevV = * frame++; // previous sample 72 | float thisV = * frame++; // this sample 73 | float nextV = * frame++; // next sample 74 | for (int i = 4; i < (numBins - 2); i++) 75 | { 76 | float nextNV = * frame++; // next next sample 77 | 78 | // check for peak relatively > PeakThreshold 79 | bool found = (thisV > PeakThreshold) && (thisV > prevV) && (thisV > nextV); 80 | 81 | if (found && (PeakWidth > 1)) // if using wide peaks, compare prevPV and nextNV 82 | found = found && (thisV > prevPV) && (thisV > nextNV); 83 | 84 | if (found) 85 | { 86 | // If peak detected, do cubic interpolation for index, // freq, and magnitude -- first calculate "real" index 87 | double realIndex = ((prevV - nextV) * 0.5) / (prevV - (2.0 * thisV) + nextV); 88 | // then interpolate the real magnitude and frequency 89 | double realPeak = thisV - ((prevV - nextV) * 0.25 * realIndex); 90 | double realFreq = data.GetFreqStep() * (float)(i-2); 91 | // Add the new peak to the list and link it in 92 | TrackData_op* thisP = new TrackData_op((float)realTime, (float)realFreq, (float)realPeak, (float)data.GetStepDur()); 93 | if (prevP != 0) 94 | prevP->linkHigher(thisP); 95 | prevP = thisP; 96 | thePeaks->Add(thisP); 97 | npeak++; 98 | } 99 | prevPV = prevV; // step the values to the next freq. bin 100 | prevV = thisV; 101 | thisV = nextV; 102 | nextV = nextNV; 103 | } 104 | } 105 | 106 | // Answer the best match for the given frequency in the given frame 107 | TrackData_op* 108 | FrameTracker_op::GetBestMatch(float pitch, TrackFrame_op* frame) 109 | { 110 | TrackData_op* match = frame->getTrackNearestFreq(pitch); 111 | if (match != 0) { // If it's within the freq. range FreqThreshold 112 | double frqDiff = fabs(log(match->getPitch()) - log(pitch)); 113 | if (frqDiff < FreqThreshold) 114 | return match; 115 | } 116 | return 0; 117 | } 118 | 119 | // Track and group peaks in the given data set; 120 | // do a running forward/backward comparison of all peaks in a track 121 | 122 | void 123 | FrameTracker_op::TrackPeaks() 124 | { 125 | 126 | TrackFrame_op* prevFr = Tracks.getBaseFrame(); 127 | TrackFrame_op* thisFr = prevFr->getNext(); 128 | TrackFrame_op* nextFr = thisFr->getNext(); 129 | TrackFrame_op* lastFr = nextFr->getNext(); 130 | while (thisFr != 0) { // Iterate over the frames trying to track peaks 131 | TrackData_op* baseTr = prevFr->getBaseTrack(); 132 | // Try to track the previous frame's peaks into this frame 133 | while (baseTr != 0) { // Find the best freq. match between track and current pks 134 | float baseP = baseTr->getPitch(); 135 | TrackData_op* match = GetBestMatch(baseP, thisFr); 136 | if (match != 0) { 137 | baseTr->linkTo(match); // create double links 138 | } 139 | baseTr = baseTr->getHigher(); 140 | } // end of current frame 141 | prevFr = thisFr; 142 | thisFr = nextFr; 143 | nextFr = lastFr; 144 | if (lastFr != 0) 145 | lastFr = lastFr->getNext(); 146 | } // end of all tracks 147 | } 148 | 149 | // Continue track groups, and gather track statistics 150 | 151 | void 152 | FrameTracker_op::ContinuePeaks() 153 | { 154 | 155 | TrackFrame_op* base = Tracks.getBaseFrame(); 156 | while (base != 0) { // Iterate over all frames 157 | TrackData_op* td = base->getBaseTrack(); 158 | while (td != 0) { // Iterate over peaks in a frame 159 | if (td->isHead()) { 160 | float am = td->getAmplitude(); 161 | float pc = td->getPitch(); 162 | float avgA = am; 163 | float avgP = pc; 164 | int i = 1; 165 | TrackData_op* tl = td->getNext(); 166 | while (tl != 0) { // Iterate forward over peaks in a track 167 | am = tl->getAmplitude(); 168 | pc = tl->getPitch(); 169 | avgA += am; 170 | avgP += pc; 171 | td->setEndPitch(pc); 172 | tl = tl->getNext(); 173 | i++; 174 | } // end of links 175 | td->setAvgAmplitude(avgA / (float) i); 176 | td->setAvgPitch(avgP / (float) i); 177 | } // end of track 178 | td = td->getHigher(); // go to next peak in frame 179 | } // end of frame 180 | base = base->getNext(); // go to next frame 181 | } 182 | } 183 | 184 | -------------------------------------------------------------------------------- /lib/frametracker_op.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | 3 | libofa -- the Open Fingerprint Architecture library 4 | 5 | Copyright (C) 2006 MusicIP Corporation 6 | All rights reserved. 7 | 8 | -------------------------------------------------------------------*/ 9 | // FILE: "frametracker_op.h" 10 | // MODULE: Class header for FrameTracker_op 11 | // AUTHOR: Stephen Pope, Frode Holm 12 | // DATE CREATED: 01/12/06 13 | 14 | 15 | #ifndef FRAME_TRACKER_OP_H 16 | #define FRAME_TRACKER_OP_H 1 17 | 18 | #include "fft_op.h" 19 | #include "tracklist_op.h" 20 | #include "trackdata_op.h" 21 | 22 | class FrameTracker_op { 23 | public: 24 | 25 | // Constructor -- here are the defaults for the thresholds 26 | 27 | FrameTracker_op( 28 | float peakT = 0.001f, // min ampl for peak detection 29 | float fThresh = 0.2, // max freq ratio for tracking between peaks 30 | float lenT = 0.1f, // min length for track (in sec) (ignored in this version) 31 | int maxTrax = 500); // max # of tracks at a time (ignored in this version) 32 | ~FrameTracker_op(); 33 | 34 | // Accessing 35 | 36 | TrackList_op* getTracks() { return &Tracks; } 37 | 38 | // The big do-it method -- run the peak-tracking 39 | 40 | void Compute(FFT_op& spectra); 41 | 42 | private: 43 | TrackList_op Tracks; // list of tracked frames 44 | float PeakThreshold; // min peak magnitude for detection 45 | float FreqThreshold; // max step between peaks for tracking 46 | float LengthThreshold; // shortest track 47 | int MaxTracks; // max # of peaks to track 48 | int PeakWidth; // min sample width for peaks (+- x) 49 | TrackFrame_op* BaseFr; 50 | 51 | // Private methods 52 | 53 | void FindPeaks(FFT_op& spectra, int frameNum, TrackFrame_op* thePeaks); 54 | TrackData_op* GetBestMatch(float pitch, TrackFrame_op* frame); 55 | void TrackPeaks(); 56 | void ContinuePeaks(); 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /lib/mainprint.cpp: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | 3 | libofa -- the Open Fingerprint Architecture library 4 | 5 | Copyright (C) 2006 MusicIP Corporation 6 | All rights reserved. 7 | 8 | -------------------------------------------------------------------*/ 9 | // FILE: "mainprint.cpp" 10 | // MODULE: Top level calling code and main functions 11 | // AUTHOR: Frode Holm 12 | // DATE CREATED: 1/12/06 13 | 14 | #include 15 | #include "ofa1/ofa.h" 16 | #include "signal_op.h" 17 | #include "fft_op.h" 18 | #include "frametracker_op.h" 19 | #include "error_op.h" 20 | 21 | #include "JAMA/jama_svd.h" 22 | 23 | using namespace TNT; 24 | using namespace JAMA; 25 | 26 | typedef float Real; 27 | 28 | // Print size 29 | const int Dim = 7; 30 | const int Res = 40; 31 | 32 | const long SongLen = 120000; // length to analyze (ms) 33 | const int FrameSize = 8192; // FFT framesize 34 | 35 | void preprocessing(short* samples, long size, int sRate, bool stereo, Signal_op& sig); 36 | void core_print(Signal_op& sig, unsigned char *out); 37 | void pitch_print(Signal_op& sig, unsigned char *out); 38 | char *base64encode(const char *input, int lentext); 39 | 40 | // Retreive the version of the library 41 | extern "C" 42 | void ofa_get_version(int *major, int *minor, int *rev) 43 | { 44 | sscanf(VERSION, "%d.%d.%d", major, minor, rev); 45 | } 46 | 47 | // ofa_create_print is the top level function generating the fingerprint. 48 | // NOTE THAT THE PASSED IN DATA MAY BE BYTE SWAPPED DURING THE METHOD. 49 | // ASSUME THAT DATA IN THE INPUT BUFFER IS DESTROYED AS A SIDE-EFFECT OF 50 | // CALLING THIS FUNCTION 51 | // 52 | // data: a buffer of 16-bit samples in interleaved format (if stereo), i.e. L,R,L,R, etc. 53 | // This buffer is destroyed during processing. 54 | // Ideally, this buffer should contain the entire song to be analyzed, but the process will only 55 | // need the first 2min + 10sec + any silence prepending the actual audio. Since the precise silence 56 | // interval will only be known after a couple of processing steps, the caller must make adequate 57 | // allowance for this. Caveat emptor. 58 | // byteOrder: OFA_LITTLE_ENDIAN, or OFA_BIG_ENDIAN - indicates the byte 59 | // order of the data being passed in. 60 | // size: the size of the buffer, in number of samples. 61 | // sRate: the sample rate of the signal. This can be an arbitrary rate, as long as it can be expressed 62 | // as an integer (in samples per second). If this is different from 44100, rate conversion will 63 | // be performed during preprocessing, which will add significantly to the overhead. 64 | // stereo: 1 if there are left and right channels stored, 0 if the data is mono 65 | // 66 | // On success, a valid text representation of the fingerprint is returned. 67 | // The returned buffer will remain valid until the next call to ofa_create_print 68 | 69 | extern "C" 70 | const char *ofa_create_print(unsigned char *data, int byteOrder, long size, int sRate, int stereo) 71 | { 72 | short *samples = (short *) data; 73 | #ifdef BIG_ENDIAN 74 | if (byteOrder == OFA_LITTLE_ENDIAN) { 75 | for (int i = 0; i < size; ++i) { 76 | samples[i] = data[2*i+1] << 8 | data[2*i]; 77 | } 78 | } 79 | #else 80 | if (byteOrder == OFA_BIG_ENDIAN) { 81 | for (int i = 0; i < size; ++i) { 82 | samples[i] = data[2*i] << 8 | data[2*i+1]; 83 | } 84 | } 85 | #endif 86 | try { 87 | Signal_op sig; 88 | unsigned char bytes[Dim * Res * 2 + 5]; 89 | 90 | preprocessing(samples, size, sRate, stereo, sig); 91 | bytes[0] = 1; // version marker 92 | core_print(sig, bytes + 1); 93 | pitch_print(sig, bytes + (Dim * Res * 2 + 1)); 94 | return base64encode((char*) bytes, Dim * Res * 2 + 5); 95 | } catch (OnePrintError e) { 96 | return 0; 97 | } 98 | } 99 | 100 | 101 | void 102 | preprocessing(short* samples, long size, int sRate, bool stereo, Signal_op& sig) 103 | { 104 | int ch = stereo ? 2 : 1; 105 | long sec135 = 135 * sRate * ch; 106 | if (size > sec135) size = sec135; 107 | 108 | sig.Load(samples, size, sRate, stereo); 109 | 110 | if (stereo) 111 | sig.PrepareStereo(44100, 50); 112 | else 113 | sig.PrepareMono(44100, 50); 114 | 115 | if (sig.GetDuration() > SongLen+10000) 116 | sig.CutSignal(10000, SongLen); 117 | } 118 | 119 | void 120 | core_print(Signal_op& sig, unsigned char *out) 121 | { 122 | FFT_op fft; 123 | 124 | fft.LoadSignal(&sig); 125 | fft.SetSize(FrameSize,false); 126 | fft.SetWindowShape(HAMMING); 127 | fft.Compute(0); 128 | 129 | fft.ReSample(Res, true); 130 | 131 | if (fft.GetNumFrames() < Res) 132 | throw OnePrintError(FILETOOSHORT); 133 | 134 | // Compute SVD 135 | int i,j; 136 | float* fr; 137 | int numBins = fft.GetNumBins(); 138 | int numFrames = fft.GetNumFrames(); 139 | 140 | Array2D in2D(numFrames, numBins); 141 | Array2D v(numBins, numBins); 142 | 143 | // copy into Array2D 144 | for (i = 0; i < numFrames; i++) 145 | { 146 | fr = fft.GetFrame(i); 147 | for (j = 0; j < numBins; j++) 148 | in2D[i][j] = fr[j]; 149 | } 150 | 151 | SVD s(in2D); 152 | s.getV(v); 153 | 154 | int pos = 0; 155 | for (i = 0; i < Dim; i++) { 156 | for (j = 0; j < Res; j++) { 157 | short value = short(v[j][i] * 32767); 158 | out[pos++] = ((value & 0xff00) >> 8); 159 | out[pos++] = (value & 0x00ff); 160 | } 161 | } 162 | } 163 | 164 | 165 | struct pitchPacket { 166 | pitchPacket() { dur = 0; tracks = 0; amp = 0; } 167 | double dur; 168 | int tracks; 169 | double amp; 170 | }; 171 | 172 | 173 | void 174 | pitch_print(Signal_op& sig, unsigned char *out) 175 | { 176 | if (sig.GetDuration() > 40000) 177 | sig.CutSignal(0, 30000); 178 | 179 | FFT_op fft; 180 | 181 | fft.LoadSignal(&sig); 182 | fft.SetSize(FrameSize,false); 183 | fft.SetWindowShape(HAMMING); 184 | fft.Compute(0.8); 185 | 186 | FrameTracker_op fTrk(0.005f, 0.03f, 0.1f); 187 | fTrk.Compute(fft); 188 | 189 | vector notes(128); 190 | double loFreq = 50; 191 | double hiFreq = 1500; 192 | 193 | // Collect track statistics 194 | TrackList_op* trl = fTrk.getTracks(); 195 | TrackFrame_op* base = trl->getBaseFrame(); 196 | double dur, amp; 197 | int avPitch; 198 | int totalTracks = 0; 199 | while (base != 0) 200 | { 201 | TrackData_op* td = base->getBaseTrack(); 202 | while (td != 0) 203 | { 204 | if (td->isHead() && td->getAvgPitch() > loFreq && td->getAvgPitch() < hiFreq) 205 | { 206 | dur = td->getDuration(); 207 | avPitch = fft.FreqToMidi(td->getAvgPitch()); 208 | amp = td->getAvgAmplitude(); 209 | notes[avPitch].dur += dur; 210 | notes[avPitch].tracks++; 211 | notes[avPitch].amp += amp; 212 | totalTracks++; 213 | } 214 | td = td->getHigher(); 215 | } 216 | base = base->getNext(); 217 | } 218 | 219 | // Find the 4 most prominent notes 220 | double maxStrength[4]; 221 | int index[4]; 222 | int i; 223 | 224 | for (i=0; i<4; i++) 225 | { 226 | maxStrength[i] = 0; 227 | index[i] = 0; 228 | } 229 | for (i=0; i<128; i++) 230 | { 231 | if (notes[i].tracks == 0) continue; 232 | 233 | double strength = notes[i].amp + notes[i].dur/10000.0; // "linear" spread 234 | 235 | // "manual" sort 236 | if (strength > maxStrength[0]) 237 | { 238 | maxStrength[3] = maxStrength[2]; 239 | maxStrength[2] = maxStrength[1]; 240 | maxStrength[1] = maxStrength[0]; 241 | maxStrength[0] = strength; 242 | index[3] = index[2]; 243 | index[2] = index[1]; 244 | index[1] = index[0]; 245 | index[0] = i; 246 | } 247 | else if (strength > maxStrength[1]) 248 | { 249 | maxStrength[3] = maxStrength[2]; 250 | maxStrength[2] = maxStrength[1]; 251 | maxStrength[1] = strength; 252 | index[3] = index[2]; 253 | index[2] = index[1]; 254 | index[1] = i; 255 | } 256 | else if (strength > maxStrength[2]) 257 | { 258 | maxStrength[3] = maxStrength[2]; 259 | maxStrength[2] = strength; 260 | index[3] = index[2]; 261 | index[2] = i; 262 | } 263 | else if (strength > maxStrength[3]) 264 | { 265 | maxStrength[3] = strength; 266 | index[3] = i; 267 | } 268 | } 269 | 270 | for (i=0; i<4; i++) 271 | { 272 | out[i] = index[i]; 273 | } 274 | } 275 | 276 | static char encodingTable[64] = { 277 | 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P', 278 | 'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f', 279 | 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v', 280 | 'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/' 281 | }; 282 | 283 | 284 | // The return buffer is only valid until the next call to this method 285 | char *base64encode(const char *input, int lentext) { 286 | static char out[758]; 287 | unsigned char inbuf[3], outbuf[4]; 288 | int i, ctcopy, pos = 0, ixtext = 0; 289 | 290 | while (true) { 291 | int ctremaining = lentext - ixtext; 292 | if (ctremaining <= 0) 293 | break; 294 | for (i = 0; i < 3; i++) { 295 | int ix = ixtext + i; 296 | if (ix < lentext) 297 | inbuf[i] = (unsigned char) input[ix]; 298 | else 299 | inbuf[i] = 0; 300 | } 301 | outbuf[0] = (unsigned char) ((inbuf [0] & 0xFC) >> 2); 302 | outbuf[1] = (unsigned char) (((inbuf [0] & 0x03) << 4) | ((inbuf [1] & 0xF0) >> 4)); 303 | outbuf[2] = (unsigned char) (((inbuf [1] & 0x0F) << 2) | ((inbuf [2] & 0xC0) >> 6)); 304 | outbuf[3] = (unsigned char) (inbuf [2] & 0x3F); 305 | 306 | switch (ctremaining) { 307 | case 1: 308 | ctcopy = 2; 309 | break; 310 | case 2: 311 | ctcopy = 3; 312 | break; 313 | default: 314 | ctcopy = 4; 315 | break; 316 | } 317 | for (i = 0; i < ctcopy; i++) { 318 | out[pos++] = encodingTable[outbuf[i]]; 319 | } 320 | for (i = ctcopy; i < 4; i++) { 321 | out[pos++] = '='; 322 | } 323 | ixtext += 3; 324 | } 325 | out[pos] = 0; 326 | return out; 327 | } 328 | 329 | -------------------------------------------------------------------------------- /lib/signal_op.cpp: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | 3 | libofa -- the Open Fingerprint Architecture library 4 | 5 | Copyright (C) 2006 MusicIP Corporation 6 | All rights reserved. 7 | 8 | -------------------------------------------------------------------*/ 9 | // FILE: "signal_op.cpp" 10 | // MODULE: Implementation for class Signal_op 11 | // AUTHOR: Frode Holm 12 | // DATE CREATED: 1/12/06 13 | 14 | 15 | #include 16 | #include "signal_op.h" 17 | #include "AFLIB/aflibConverter.h" 18 | #include "error_op.h" 19 | 20 | 21 | Signal_op::Signal_op() 22 | { 23 | Data = 0; 24 | iOwnData = false; 25 | NumChannels = 0; 26 | BufSize = 0; 27 | NumBlocks = 0; 28 | Rate = 0; 29 | } 30 | 31 | Signal_op::~Signal_op() 32 | { 33 | if (iOwnData) 34 | delete[] Data; 35 | } 36 | 37 | 38 | void 39 | Signal_op::Load(short* samples, long size, int sRate, bool stereo) 40 | { 41 | Data = samples; 42 | iOwnData = false; 43 | NumChannels = stereo ? 2 : 1; 44 | BufSize = size; 45 | NumBlocks = BufSize / NumChannels; 46 | Rate = sRate; 47 | } 48 | 49 | 50 | // CutSignal deletes samples from the sample buffer 51 | void 52 | Signal_op::CutSignal(double start, double dur) 53 | { 54 | int i, n; 55 | short* samples = Data; 56 | 57 | long startS = (long)(start * Rate / 1000.0); 58 | long stopS = (long)(startS + dur * Rate / 1000.0); 59 | 60 | NumBlocks = (stopS-startS); 61 | if (NumBlocks <= 0) 62 | throw OnePrintError("Programming error: CutSignal"); 63 | 64 | BufSize = NumBlocks * NumChannels; 65 | short* tmpBuf = new short[BufSize]; 66 | 67 | startS *= NumChannels; 68 | stopS *= NumChannels; 69 | 70 | // Copy to new buffer 71 | for (i=startS, n=0; i= silBlock) 172 | { 173 | double av = (double)sum/silBlock; 174 | if (av > startTh) 175 | { 176 | start -= count-1; 177 | break; 178 | } 179 | count = 0; 180 | sum = 0; 181 | } 182 | 183 | start++; 184 | } 185 | if (start < 0) start = 0; 186 | 187 | // Back silence removal 188 | count = 0; 189 | sum = 0; 190 | while (stop > start) 191 | { 192 | sum += abs(samples[stop-1]); 193 | count++; 194 | if (count >= silBlock) 195 | { 196 | double av = (double)sum/silBlock; 197 | if (av > endTh) 198 | { 199 | stop += count; 200 | break; 201 | } 202 | count = 0; 203 | sum = 0; 204 | } 205 | 206 | stop--; 207 | } 208 | if (stop > NumBlocks) stop = NumBlocks; 209 | 210 | if (stop-start <= 0) 211 | throw OnePrintError("Signal has silence only", SILENCEONLY); 212 | 213 | NumBlocks = (stop-start); 214 | if (NumBlocks <= 0) 215 | throw OnePrintError("Signal is corrupt"); 216 | 217 | BufSize = NumBlocks; 218 | short* tmpBuf = new short[BufSize]; 219 | 220 | // Copy to new buffer 221 | for (i=start, n=0; i lim*3) 247 | { 248 | sum += yn; 249 | cnt++; 250 | } 251 | if (x[n-1] > maxP) 252 | maxP = x[n-1]; 253 | if (x[n-1] < maxN) 254 | maxN = x[n-1]; 255 | } 256 | 257 | double dcOffset = sum/(double)cnt; 258 | 259 | // Remove if greater than this 260 | if (fabs(dcOffset) > 15) // otherwise don't bother 261 | { 262 | // Check to se if we have to "denormalize" to make sure there's headroom for the DC removal 263 | double factorP=0, factorN=0, factor=0; 264 | if (maxP - dcOffset > MaxSample) 265 | factorP = ((double)MaxSample - dcOffset) / maxP; 266 | if (maxN - dcOffset < MinSample) 267 | factorN = ((double)MinSample + dcOffset) / maxN; 268 | // only one can apply 269 | if (factorP > 0) 270 | factor = factorP; 271 | else if (factorN > 0) 272 | factor = factorN; 273 | 274 | for (long i=0; i 0) 278 | sample *= factor; 279 | sample -= dcOffset; 280 | // round sample 281 | if (sample > 0) 282 | x[i] = (short) floor(sample + 0.5); 283 | else 284 | x[i] = (short) ceil(sample - 0.5); 285 | } 286 | } 287 | } 288 | 289 | 290 | void 291 | Signal_op::Normalize() 292 | { 293 | short* samples = Data; 294 | 295 | long i; 296 | int max = 0; 297 | double factor; 298 | 299 | for (i=0; i max) 302 | max = abs(samples[i]); 303 | } 304 | 305 | if (max >= MaxSample) { 306 | factor = 1; 307 | } else { 308 | factor = MaxSample / (double) max; 309 | for (i=0; i 0) 314 | samples[i] = (short) floor(tmp + 0.5); 315 | else 316 | samples[i] = (short) ceil(tmp - 0.5); 317 | } 318 | } 319 | } 320 | 321 | 322 | 323 | // Mono signals only 324 | void 325 | Signal_op::ConvertSampleRate(long targetSR) 326 | { 327 | if (NumChannels > 1) return; 328 | 329 | aflibConverter srConv(true, false, true); // Large filter with coefficients interpolation 330 | 331 | double factor = (double)targetSR/(double)Rate; 332 | 333 | long tmpSize = (long) (BufSize * factor + 2); 334 | short* tmpBuf = new short[tmpSize]; 335 | 336 | srConv.initialize(factor, 1); 337 | 338 | int inCount = BufSize; 339 | int outCount = (int) (BufSize * factor); 340 | int outRet; 341 | outRet = srConv.resample(inCount, outCount, GetBuffer(), tmpBuf); 342 | 343 | if (iOwnData) 344 | delete[] Data; 345 | Data = tmpBuf; 346 | iOwnData = true; 347 | Rate = targetSR; 348 | NumBlocks = BufSize = outRet; 349 | } 350 | 351 | 352 | double 353 | Signal_op::GetCrossCorrelation() 354 | { 355 | // Cross Channel Correlation - stereo signals only 356 | long k; 357 | double C12 = 0, C11 = 0, C22 = 0; 358 | short* samples = Data; 359 | 360 | for (k=0; k (b)) ? (a) : (b)) 17 | #define min(a,b) (((a) < (b)) ? (a) : (b)) 18 | 19 | 20 | // Constructor 21 | 22 | TrackData_op::TrackData_op() { /* empty */ } 23 | 24 | TrackData_op::TrackData_op(float aTime, float frequency, float amplitude, float frDur) 25 | { 26 | StartTime = aTime; 27 | EndTime = 0.0f; 28 | Pitch = AvgPitch = EndPitch = frequency; 29 | Amplitude = AvgAmplitude = amplitude; 30 | FrameDur = frDur; 31 | previous = 0; 32 | next = 0; 33 | higher = 0; 34 | InTrack = false; 35 | } 36 | 37 | TrackData_op::~TrackData_op() 38 | { 39 | previous = next = higher = 0; 40 | } 41 | 42 | float 43 | TrackData_op::getDuration() 44 | { 45 | if (isOrphan()) 46 | return FrameDur; 47 | if ( ! (isHead())) 48 | return (StartTime); 49 | if (EndTime == 0.0f) { 50 | TrackData_op* trk = getTail(); 51 | EndTime = trk->getTime() + FrameDur; 52 | } 53 | return (EndTime - StartTime); 54 | } 55 | 56 | 57 | // Extend the receiver by the argument 58 | 59 | void 60 | TrackData_op::linkTo(TrackData_op* tp) 61 | { 62 | tp->linkPrevious(this); 63 | linkNext(tp); 64 | InTrack = true; 65 | tp->SetInTrack(true); 66 | } 67 | 68 | 69 | // Walk the links back to the head of this track 70 | 71 | TrackData_op* 72 | TrackData_op::getHead() 73 | { 74 | TrackData_op* trk; 75 | trk = this; 76 | while (trk->getPrev() != 0) 77 | trk = trk->getPrev(); 78 | return trk; 79 | } 80 | 81 | 82 | // Walk the links forward to the tail of this track 83 | 84 | TrackData_op* 85 | TrackData_op::getTail() 86 | { 87 | TrackData_op* trk; 88 | trk = this; 89 | while (trk->getNext() != 0) 90 | trk = trk->getNext(); 91 | return trk; 92 | } 93 | 94 | -------------------------------------------------------------------------------- /lib/trackdata_op.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | 3 | libofa -- the Open Fingerprint Architecture library 4 | 5 | Copyright (C) 2006 MusicIP Corporation 6 | All rights reserved. 7 | 8 | -------------------------------------------------------------------*/ 9 | // FILE: "trackdata_op.h" 10 | // MODULE: Specification file for track data elements 11 | // AUTHOR: Stephen Pope 12 | // DATE CREATED: 01/12/06 13 | 14 | #ifndef TRACK_DATA_OP_H 15 | #define TRACK_DATA_OP_H 1 16 | 17 | 18 | class TrackData_op { 19 | 20 | public: 21 | TrackData_op(); 22 | TrackData_op(float time, float frequency, float amplitude, float frDur); 23 | ~TrackData_op(); 24 | 25 | // Accessing methods 26 | 27 | float getTime() const { return StartTime; } 28 | float getAmplitude() const { return Amplitude; } 29 | float getPitch() const { return Pitch;} 30 | float getEndPitch() const { return EndPitch;} 31 | float getAvgAmplitude() const { return AvgAmplitude; } 32 | float getAvgPitch() const { return AvgPitch;} 33 | void setAvgAmplitude(float val) { AvgAmplitude = val; } 34 | void setAvgPitch(float val) { AvgPitch = val;} 35 | void setEndPitch(float val) { EndPitch = val;} 36 | 37 | float getDuration(); 38 | float getStartTime() const { return StartTime; } 39 | 40 | void SetInTrack(bool in) { InTrack = in; } 41 | bool IsInTrack() { return InTrack; } 42 | 43 | // Data/frame/list structure 44 | 45 | void linkTo(TrackData_op* pr); 46 | void linkPrevious(TrackData_op* pr) { previous = pr; } 47 | void linkNext(TrackData_op* pr) { next = pr; } 48 | 49 | TrackData_op* getPrev() const { return previous; } 50 | TrackData_op* getNext() const { return next; } 51 | TrackData_op* getHigher() const { return higher; } 52 | void linkHigher(TrackData_op* pr) { higher = pr; } 53 | TrackData_op* getHead(); 54 | TrackData_op* getTail(); 55 | 56 | // Inquiry 57 | 58 | bool isOrphan() const { return ((previous == 0) && (next == 0)); } 59 | bool isHead() const { return ((previous == 0) && (next != 0)); } 60 | bool isTail() const { return ((previous != 0) && (next == 0)); } 61 | 62 | private: 63 | 64 | // Instance variables 65 | 66 | float Amplitude; // single values 67 | float Pitch; 68 | float StartTime; 69 | float EndTime; 70 | float AvgAmplitude; 71 | float AvgPitch; 72 | float EndPitch; 73 | float FrameDur; 74 | 75 | // Inter-item links 76 | 77 | TrackData_op* previous; 78 | TrackData_op* next; 79 | TrackData_op* higher; 80 | 81 | // State 82 | bool InTrack; 83 | }; 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /lib/trackframe_op.cpp: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | 3 | libofa -- the Open Fingerprint Architecture library 4 | 5 | Copyright (C) 2006 MusicIP Corporation 6 | All rights reserved. 7 | 8 | -------------------------------------------------------------------*/ 9 | // FILE: "trackframe_op.cpp" 10 | // MODULE: Implementation for class TrackFrame_op 11 | // AUTHOR: Stephen Pope 12 | // DATE CREATED: 01/12/06 13 | 14 | #include 15 | #include "trackdata_op.h" 16 | #include "trackframe_op.h" 17 | 18 | // Constructor 19 | 20 | TrackFrame_op::TrackFrame_op(float aTime) 21 | { 22 | FrameTime = aTime; 23 | NumTracks = 0; 24 | BaseTr = 0; 25 | NextFr = 0; 26 | } 27 | 28 | // Delete the list of peaks on delete 29 | 30 | TrackFrame_op::~TrackFrame_op() 31 | { 32 | TrackData_op* trk = BaseTr; 33 | while (trk != 0) { 34 | TrackData_op* next = trk->getHigher(); 35 | delete trk; 36 | trk = next; 37 | } 38 | } 39 | 40 | // Element add/remove 41 | 42 | void 43 | TrackFrame_op::Add(TrackData_op* td) 44 | { 45 | if (NumTracks == 0) 46 | BaseTr = td; 47 | NumTracks++; 48 | } 49 | 50 | // Answer the best-match (in frequency) track to the given value 51 | 52 | TrackData_op* 53 | TrackFrame_op::getTrackNearestFreq(float freq) 54 | { 55 | 56 | double diff; 57 | double minDiff = 10000; 58 | TrackData_op* answer; 59 | answer = 0; 60 | TrackData_op* ptr = BaseTr; 61 | // Iterate over the receiver's peaks 62 | while (ptr != 0) { 63 | if (!ptr->IsInTrack()) 64 | { 65 | // Find minimum frequency difference 66 | diff = fabs (ptr->getPitch() - freq); 67 | if (diff < minDiff) { 68 | minDiff = diff; 69 | answer = ptr; 70 | } 71 | } 72 | ptr = ptr->getHigher(); 73 | } 74 | return answer; 75 | } 76 | 77 | -------------------------------------------------------------------------------- /lib/trackframe_op.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | 3 | libofa -- the Open Fingerprint Architecture library 4 | 5 | Copyright (C) 2006 MusicIP Corporation 6 | All rights reserved. 7 | 8 | -------------------------------------------------------------------*/ 9 | // FILE: "trackframe_op.h" 10 | // MODULE: Specification file for composite track frame objects 11 | // AUTHOR: Stephen Pope 12 | // DATE CREATED: 01/12/06 13 | 14 | class TrackData_op; 15 | 16 | class TrackFrame_op { 17 | 18 | public: 19 | 20 | // Constructor 21 | 22 | TrackFrame_op(float aTime = 0.0f); 23 | ~TrackFrame_op(); 24 | 25 | // Accessing methods 26 | 27 | void Add(TrackData_op* td); 28 | inline TrackData_op* getBaseTrack() { return BaseTr; } 29 | inline TrackFrame_op* getNext() { return NextFr; } 30 | inline void setNext(TrackFrame_op* td) { NextFr = td; } 31 | inline float getTime() { return FrameTime; } 32 | 33 | TrackData_op* getTrackNearestFreq(float freq); 34 | 35 | private: 36 | 37 | // Instance variables 38 | 39 | int NumTracks; 40 | float FrameTime; 41 | TrackData_op* BaseTr; 42 | TrackFrame_op* NextFr; 43 | 44 | }; 45 | -------------------------------------------------------------------------------- /lib/tracklist_op.cpp: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | 3 | libofa -- the Open Fingerprint Architecture library 4 | 5 | Copyright (C) 2006 MusicIP Corporation 6 | All rights reserved. 7 | 8 | -------------------------------------------------------------------*/ 9 | // FILE: "tracklist_op.cpp" 10 | // MODULE: Implementation for class TrackList 11 | // AUTHOR: Stephen Pope 12 | // DATE CREATED: 01/12/06 13 | 14 | 15 | #include "trackdata_op.h" 16 | #include "tracklist_op.h" 17 | 18 | // Constructor 19 | 20 | TrackList_op::TrackList_op() 21 | { 22 | NumFrames = 0; 23 | BaseFr = 0; 24 | LastFr = 0; 25 | } 26 | 27 | // Delete the list of frames on delete 28 | 29 | TrackList_op::~TrackList_op() 30 | { 31 | TrackFrame_op* frm = BaseFr; 32 | while (frm != 0) { 33 | TrackFrame_op* next = frm->getNext(); 34 | delete frm; 35 | frm = next; 36 | } 37 | } 38 | 39 | // Element add/remove 40 | 41 | void 42 | TrackList_op::Add(TrackFrame_op* td) 43 | { 44 | if (NumFrames == 0) { 45 | BaseFr = td; 46 | LastFr = td; 47 | } else { 48 | LastFr->setNext(td); 49 | LastFr = td; 50 | } 51 | NumFrames++; 52 | } 53 | 54 | 55 | -------------------------------------------------------------------------------- /lib/tracklist_op.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------------------ 2 | 3 | libofa -- the Open Fingerprint Architecture library 4 | 5 | Copyright (C) 2006 MusicIP Corporation 6 | All rights reserved. 7 | 8 | -------------------------------------------------------------------*/ 9 | // FILE: "tracklist_op.h" 10 | // MODULE: Specification file for composite track list objects 11 | // AUTHOR: Stephen Pope 12 | // DATE CREATED: 01/12/06 13 | 14 | #include "trackframe_op.h" 15 | 16 | class TrackList_op { 17 | 18 | public: 19 | // Constructor 20 | TrackList_op(); 21 | ~TrackList_op(); 22 | 23 | // Accessing methods 24 | void Add(TrackFrame_op* td); 25 | TrackFrame_op* getBaseFrame() { return BaseFr; } 26 | int getSize() { return NumFrames; } 27 | 28 | private: 29 | int NumFrames; 30 | TrackFrame_op* BaseFr; 31 | TrackFrame_op* LastFr; 32 | }; 33 | -------------------------------------------------------------------------------- /libofa.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libofa 7 | Description: The Open Fingerprint Architecture Library 8 | URL: http://www.musicdns.org/ 9 | Version: @VERSION@ 10 | Requires: fftw3 11 | Libs: -L${libdir} -lofa -lexpat -lm 12 | Cflags: -I${includedir} 13 | -------------------------------------------------------------------------------- /missing: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Common stub for a few missing GNU programs while installing. 3 | 4 | scriptversion=2003-09-02.23 5 | 6 | # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 7 | # Free Software Foundation, Inc. 8 | # Originally by Fran,cois Pinard , 1996. 9 | 10 | # This program is free software; you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation; either version 2, or (at your option) 13 | # any later version. 14 | 15 | # This program is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | 20 | # You should have received a copy of the GNU General Public License 21 | # along with this program; if not, write to the Free Software 22 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 23 | # 02111-1307, USA. 24 | 25 | # As a special exception to the GNU General Public License, if you 26 | # distribute this file as part of a program that contains a 27 | # configuration script generated by Autoconf, you may include it under 28 | # the same distribution terms that you use for the rest of that program. 29 | 30 | if test $# -eq 0; then 31 | echo 1>&2 "Try \`$0 --help' for more information" 32 | exit 1 33 | fi 34 | 35 | run=: 36 | 37 | # In the cases where this matters, `missing' is being run in the 38 | # srcdir already. 39 | if test -f configure.ac; then 40 | configure_ac=configure.ac 41 | else 42 | configure_ac=configure.in 43 | fi 44 | 45 | msg="missing on your system" 46 | 47 | case "$1" in 48 | --run) 49 | # Try to run requested program, and just exit if it succeeds. 50 | run= 51 | shift 52 | "$@" && exit 0 53 | # Exit code 63 means version mismatch. This often happens 54 | # when the user try to use an ancient version of a tool on 55 | # a file that requires a minimum version. In this case we 56 | # we should proceed has if the program had been absent, or 57 | # if --run hadn't been passed. 58 | if test $? = 63; then 59 | run=: 60 | msg="probably too old" 61 | fi 62 | ;; 63 | esac 64 | 65 | # If it does not exist, or fails to run (possibly an outdated version), 66 | # try to emulate it. 67 | case "$1" in 68 | 69 | -h|--h|--he|--hel|--help) 70 | echo "\ 71 | $0 [OPTION]... PROGRAM [ARGUMENT]... 72 | 73 | Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 74 | error status if there is no known handling for PROGRAM. 75 | 76 | Options: 77 | -h, --help display this help and exit 78 | -v, --version output version information and exit 79 | --run try to run the given command, and emulate it if it fails 80 | 81 | Supported PROGRAM values: 82 | aclocal touch file \`aclocal.m4' 83 | autoconf touch file \`configure' 84 | autoheader touch file \`config.h.in' 85 | automake touch all \`Makefile.in' files 86 | bison create \`y.tab.[ch]', if possible, from existing .[ch] 87 | flex create \`lex.yy.c', if possible, from existing .c 88 | help2man touch the output file 89 | lex create \`lex.yy.c', if possible, from existing .c 90 | makeinfo touch the output file 91 | tar try tar, gnutar, gtar, then tar without non-portable flags 92 | yacc create \`y.tab.[ch]', if possible, from existing .[ch] 93 | 94 | Send bug reports to ." 95 | ;; 96 | 97 | -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 98 | echo "missing $scriptversion (GNU Automake)" 99 | ;; 100 | 101 | -*) 102 | echo 1>&2 "$0: Unknown \`$1' option" 103 | echo 1>&2 "Try \`$0 --help' for more information" 104 | exit 1 105 | ;; 106 | 107 | aclocal*) 108 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 109 | # We have it, but it failed. 110 | exit 1 111 | fi 112 | 113 | echo 1>&2 "\ 114 | WARNING: \`$1' is $msg. You should only need it if 115 | you modified \`acinclude.m4' or \`${configure_ac}'. You might want 116 | to install the \`Automake' and \`Perl' packages. Grab them from 117 | any GNU archive site." 118 | touch aclocal.m4 119 | ;; 120 | 121 | autoconf) 122 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 123 | # We have it, but it failed. 124 | exit 1 125 | fi 126 | 127 | echo 1>&2 "\ 128 | WARNING: \`$1' is $msg. You should only need it if 129 | you modified \`${configure_ac}'. You might want to install the 130 | \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 131 | archive site." 132 | touch configure 133 | ;; 134 | 135 | autoheader) 136 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 137 | # We have it, but it failed. 138 | exit 1 139 | fi 140 | 141 | echo 1>&2 "\ 142 | WARNING: \`$1' is $msg. You should only need it if 143 | you modified \`acconfig.h' or \`${configure_ac}'. You might want 144 | to install the \`Autoconf' and \`GNU m4' packages. Grab them 145 | from any GNU archive site." 146 | files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 147 | test -z "$files" && files="config.h" 148 | touch_files= 149 | for f in $files; do 150 | case "$f" in 151 | *:*) touch_files="$touch_files "`echo "$f" | 152 | sed -e 's/^[^:]*://' -e 's/:.*//'`;; 153 | *) touch_files="$touch_files $f.in";; 154 | esac 155 | done 156 | touch $touch_files 157 | ;; 158 | 159 | automake*) 160 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 161 | # We have it, but it failed. 162 | exit 1 163 | fi 164 | 165 | echo 1>&2 "\ 166 | WARNING: \`$1' is $msg. You should only need it if 167 | you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 168 | You might want to install the \`Automake' and \`Perl' packages. 169 | Grab them from any GNU archive site." 170 | find . -type f -name Makefile.am -print | 171 | sed 's/\.am$/.in/' | 172 | while read f; do touch "$f"; done 173 | ;; 174 | 175 | autom4te) 176 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 177 | # We have it, but it failed. 178 | exit 1 179 | fi 180 | 181 | echo 1>&2 "\ 182 | WARNING: \`$1' is needed, but is $msg. 183 | You might have modified some files without having the 184 | proper tools for further handling them. 185 | You can get \`$1' as part of \`Autoconf' from any GNU 186 | archive site." 187 | 188 | file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 189 | test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 190 | if test -f "$file"; then 191 | touch $file 192 | else 193 | test -z "$file" || exec >$file 194 | echo "#! /bin/sh" 195 | echo "# Created by GNU Automake missing as a replacement of" 196 | echo "# $ $@" 197 | echo "exit 0" 198 | chmod +x $file 199 | exit 1 200 | fi 201 | ;; 202 | 203 | bison|yacc) 204 | echo 1>&2 "\ 205 | WARNING: \`$1' $msg. You should only need it if 206 | you modified a \`.y' file. You may need the \`Bison' package 207 | in order for those modifications to take effect. You can get 208 | \`Bison' from any GNU archive site." 209 | rm -f y.tab.c y.tab.h 210 | if [ $# -ne 1 ]; then 211 | eval LASTARG="\${$#}" 212 | case "$LASTARG" in 213 | *.y) 214 | SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 215 | if [ -f "$SRCFILE" ]; then 216 | cp "$SRCFILE" y.tab.c 217 | fi 218 | SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 219 | if [ -f "$SRCFILE" ]; then 220 | cp "$SRCFILE" y.tab.h 221 | fi 222 | ;; 223 | esac 224 | fi 225 | if [ ! -f y.tab.h ]; then 226 | echo >y.tab.h 227 | fi 228 | if [ ! -f y.tab.c ]; then 229 | echo 'main() { return 0; }' >y.tab.c 230 | fi 231 | ;; 232 | 233 | lex|flex) 234 | echo 1>&2 "\ 235 | WARNING: \`$1' is $msg. You should only need it if 236 | you modified a \`.l' file. You may need the \`Flex' package 237 | in order for those modifications to take effect. You can get 238 | \`Flex' from any GNU archive site." 239 | rm -f lex.yy.c 240 | if [ $# -ne 1 ]; then 241 | eval LASTARG="\${$#}" 242 | case "$LASTARG" in 243 | *.l) 244 | SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 245 | if [ -f "$SRCFILE" ]; then 246 | cp "$SRCFILE" lex.yy.c 247 | fi 248 | ;; 249 | esac 250 | fi 251 | if [ ! -f lex.yy.c ]; then 252 | echo 'main() { return 0; }' >lex.yy.c 253 | fi 254 | ;; 255 | 256 | help2man) 257 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 258 | # We have it, but it failed. 259 | exit 1 260 | fi 261 | 262 | echo 1>&2 "\ 263 | WARNING: \`$1' is $msg. You should only need it if 264 | you modified a dependency of a manual page. You may need the 265 | \`Help2man' package in order for those modifications to take 266 | effect. You can get \`Help2man' from any GNU archive site." 267 | 268 | file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 269 | if test -z "$file"; then 270 | file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 271 | fi 272 | if [ -f "$file" ]; then 273 | touch $file 274 | else 275 | test -z "$file" || exec >$file 276 | echo ".ab help2man is required to generate this page" 277 | exit 1 278 | fi 279 | ;; 280 | 281 | makeinfo) 282 | if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then 283 | # We have makeinfo, but it failed. 284 | exit 1 285 | fi 286 | 287 | echo 1>&2 "\ 288 | WARNING: \`$1' is $msg. You should only need it if 289 | you modified a \`.texi' or \`.texinfo' file, or any other file 290 | indirectly affecting the aspect of the manual. The spurious 291 | call might also be the consequence of using a buggy \`make' (AIX, 292 | DU, IRIX). You might want to install the \`Texinfo' package or 293 | the \`GNU make' package. Grab either from any GNU archive site." 294 | file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 295 | if test -z "$file"; then 296 | file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 297 | file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` 298 | fi 299 | touch $file 300 | ;; 301 | 302 | tar) 303 | shift 304 | if test -n "$run"; then 305 | echo 1>&2 "ERROR: \`tar' requires --run" 306 | exit 1 307 | fi 308 | 309 | # We have already tried tar in the generic part. 310 | # Look for gnutar/gtar before invocation to avoid ugly error 311 | # messages. 312 | if (gnutar --version > /dev/null 2>&1); then 313 | gnutar "$@" && exit 0 314 | fi 315 | if (gtar --version > /dev/null 2>&1); then 316 | gtar "$@" && exit 0 317 | fi 318 | firstarg="$1" 319 | if shift; then 320 | case "$firstarg" in 321 | *o*) 322 | firstarg=`echo "$firstarg" | sed s/o//` 323 | tar "$firstarg" "$@" && exit 0 324 | ;; 325 | esac 326 | case "$firstarg" in 327 | *h*) 328 | firstarg=`echo "$firstarg" | sed s/h//` 329 | tar "$firstarg" "$@" && exit 0 330 | ;; 331 | esac 332 | fi 333 | 334 | echo 1>&2 "\ 335 | WARNING: I can't seem to be able to run \`tar' with the given arguments. 336 | You may want to install GNU tar or Free paxutils, or check the 337 | command line arguments." 338 | exit 1 339 | ;; 340 | 341 | *) 342 | echo 1>&2 "\ 343 | WARNING: \`$1' is needed, and is $msg. 344 | You might have modified some files without having the 345 | proper tools for further handling them. Check the \`README' file, 346 | it often tells you about the needed prerequisites for installing 347 | this package. You may also peek at any GNU archive site, in case 348 | some other package would contain this missing \`$1' program." 349 | exit 1 350 | ;; 351 | esac 352 | 353 | exit 0 354 | 355 | # Local variables: 356 | # eval: (add-hook 'write-file-hooks 'time-stamp) 357 | # time-stamp-start: "scriptversion=" 358 | # time-stamp-format: "%:y-%02m-%02d.%02H" 359 | # time-stamp-end: "$" 360 | # End: 361 | --------------------------------------------------------------------------------