From bb96c9174ee9306b3ab5100ff7d863ac2ec5b1bb Mon Sep 17 00:00:00 2001 From: qinwf Date: Fri, 19 Oct 2018 14:45:21 +0800 Subject: [PATCH 1/7] remove unused files --- deps/pHash/pHash.gyp | 1 - deps/pHash/ph_fft.c | 75 -------------------------------------------- deps/pHash/ph_fft.h | 37 ---------------------- 3 files changed, 113 deletions(-) delete mode 100644 deps/pHash/ph_fft.c delete mode 100644 deps/pHash/ph_fft.h diff --git a/deps/pHash/pHash.gyp b/deps/pHash/pHash.gyp index 314642f..0a30eee 100644 --- a/deps/pHash/pHash.gyp +++ b/deps/pHash/pHash.gyp @@ -16,7 +16,6 @@ '../libjpeg', ], 'sources': [ - './ph_fft.c', './pHash.cpp', './phcomplex.c', ], diff --git a/deps/pHash/ph_fft.c b/deps/pHash/ph_fft.c deleted file mode 100644 index 27b5ef1..0000000 --- a/deps/pHash/ph_fft.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - - pHash, the open source perceptual hash library - Copyright (C) 2009 Aetilius, Inc. - All rights reserved. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - - Evan Klinger - eklinger@phash.org - D Grant Starkweather - dstarkweather@phash.org - -*/ - - - -#include "ph_fft.h" - -complex double polar_to_complex(const double r, const double theta) -{ - complex double result; - result = r*cos(theta) + r*sin(theta)*I; - - return result; -} - -void fft_calc(const int N,const double *x,complex double *X,complex double *P,const int step,const complex double *twids) -{ - complex double *S = P + N/2; - if (N == 1){ - X[0] = x[0]; - return; - } - - fft_calc(N/2, x, S, X,2*step, twids); - fft_calc(N/2, x+step, P, X,2*step, twids); - - int k; - for (k=0;k. - - Evan Klinger - eklinger@phash.org - D Grant Starkweather - dstarkweather@phash.org - -*/ - - -#ifndef _FFT_H -#define _FFT_H - -#define PI 3.1415926535897932 - -#include -#include -#include - -int fft(double *x, int N, complex double *X); - -#endif From 8cf43b527f064398f96cf41804be39dbd84eb379 Mon Sep 17 00:00:00 2001 From: FENG Jiabin Date: Mon, 30 Nov 2020 14:59:38 +0800 Subject: [PATCH 2/7] testing macOS build --- deps/zlib/zconf.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deps/zlib/zconf.h b/deps/zlib/zconf.h index 9987a77..b4aae2c 100644 --- a/deps/zlib/zconf.h +++ b/deps/zlib/zconf.h @@ -444,6 +444,9 @@ typedef uLong FAR uLongf; # undef _LARGEFILE64_SOURCE #endif +// FIXME +# include + #if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) # define Z_HAVE_UNISTD_H #endif From 9eb44984433c1457db25020c0c64b3521f5769d7 Mon Sep 17 00:00:00 2001 From: FENG Jiabin Date: Mon, 30 Nov 2020 15:18:32 +0800 Subject: [PATCH 3/7] add HAVE_UNISTD_H --- deps/common.gyp | 7 +++++-- deps/zlib/zconf.h | 3 --- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/deps/common.gyp b/deps/common.gyp index 201c6b5..df8b97c 100644 --- a/deps/common.gyp +++ b/deps/common.gyp @@ -10,8 +10,11 @@ { 'xcode_settings': { 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', - } - } + }, + 'defines': [ + 'HAVE_UNISTD_H', + ], + }, ], ['OS=="win"', { diff --git a/deps/zlib/zconf.h b/deps/zlib/zconf.h index b4aae2c..9987a77 100644 --- a/deps/zlib/zconf.h +++ b/deps/zlib/zconf.h @@ -444,9 +444,6 @@ typedef uLong FAR uLongf; # undef _LARGEFILE64_SOURCE #endif -// FIXME -# include - #if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) # define Z_HAVE_UNISTD_H #endif From 25148fccd4167e7ccac22d10ec2d6d023fbd0295 Mon Sep 17 00:00:00 2001 From: FENG Jiabin Date: Mon, 30 Nov 2020 16:59:00 +0800 Subject: [PATCH 4/7] Revert "remove unused files" This reverts commit bb96c9174ee9306b3ab5100ff7d863ac2ec5b1bb. --- deps/pHash/pHash.gyp | 1 + deps/pHash/ph_fft.c | 75 ++++++++++++++++++++++++++++++++++++++++++++ deps/pHash/ph_fft.h | 37 ++++++++++++++++++++++ 3 files changed, 113 insertions(+) create mode 100644 deps/pHash/ph_fft.c create mode 100644 deps/pHash/ph_fft.h diff --git a/deps/pHash/pHash.gyp b/deps/pHash/pHash.gyp index 0a30eee..314642f 100644 --- a/deps/pHash/pHash.gyp +++ b/deps/pHash/pHash.gyp @@ -16,6 +16,7 @@ '../libjpeg', ], 'sources': [ + './ph_fft.c', './pHash.cpp', './phcomplex.c', ], diff --git a/deps/pHash/ph_fft.c b/deps/pHash/ph_fft.c new file mode 100644 index 0000000..27b5ef1 --- /dev/null +++ b/deps/pHash/ph_fft.c @@ -0,0 +1,75 @@ +/* + + pHash, the open source perceptual hash library + Copyright (C) 2009 Aetilius, Inc. + All rights reserved. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + Evan Klinger - eklinger@phash.org + D Grant Starkweather - dstarkweather@phash.org + +*/ + + + +#include "ph_fft.h" + +complex double polar_to_complex(const double r, const double theta) +{ + complex double result; + result = r*cos(theta) + r*sin(theta)*I; + + return result; +} + +void fft_calc(const int N,const double *x,complex double *X,complex double *P,const int step,const complex double *twids) +{ + complex double *S = P + N/2; + if (N == 1){ + X[0] = x[0]; + return; + } + + fft_calc(N/2, x, S, X,2*step, twids); + fft_calc(N/2, x+step, P, X,2*step, twids); + + int k; + for (k=0;k. + + Evan Klinger - eklinger@phash.org + D Grant Starkweather - dstarkweather@phash.org + +*/ + + +#ifndef _FFT_H +#define _FFT_H + +#define PI 3.1415926535897932 + +#include +#include +#include + +int fft(double *x, int N, complex double *X); + +#endif From 73eab371c0a244682851a3574724620ac08518d8 Mon Sep 17 00:00:00 2001 From: FENG Jiabin Date: Mon, 30 Nov 2020 17:02:48 +0800 Subject: [PATCH 5/7] fix complex.h --- deps/pHash/ph_fft.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/pHash/ph_fft.h b/deps/pHash/ph_fft.h index b1b3684..836f057 100644 --- a/deps/pHash/ph_fft.h +++ b/deps/pHash/ph_fft.h @@ -29,7 +29,7 @@ #define PI 3.1415926535897932 #include -#include +#include #include int fft(double *x, int N, complex double *X); From 950d97853dc7f985b5124e5b28287d99d65281c6 Mon Sep 17 00:00:00 2001 From: FENG Jiabin Date: Thu, 4 Sep 2025 20:31:36 +0800 Subject: [PATCH 6/7] remove fp.h to adapt new Xcode https://github.com/pnggroup/libpng/commit/893b8113f04d408cc6177c6de19c9889a48faa24 --- deps/libpng/pngpriv.h | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/deps/libpng/pngpriv.h b/deps/libpng/pngpriv.h index cbd66de..35e5273 100644 --- a/deps/libpng/pngpriv.h +++ b/deps/libpng/pngpriv.h @@ -436,18 +436,8 @@ */ # include -# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \ - defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC) - /* We need to check that hasn't already been included earlier - * as it seems it doesn't agree with , yet we should really use - * if possible. - */ -# if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__) -# include -# endif -# else -# include -# endif +# include + # if defined(_AMIGA) && defined(__SASC) && defined(_M68881) /* Amiga SAS/C: We must include builtin FPU functions when compiling using * MATH=68881 @@ -910,7 +900,7 @@ PNG_INTERNAL_FUNCTION(png_voidp,png_malloc_base,(png_const_structrp png_ptr, #if defined(PNG_TEXT_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) ||\ defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED) /* Internal array allocator, outputs no error or warning messages on failure, - * just returns NULL. + * just returns NULL. */ PNG_INTERNAL_FUNCTION(png_voidp,png_malloc_array,(png_const_structrp png_ptr, int nelements, size_t element_size),PNG_ALLOCATED); From 4168a4528019579c39991f3632ee5c4e34230166 Mon Sep 17 00:00:00 2001 From: FENG Jiabin Date: Thu, 4 Sep 2025 23:16:09 +0800 Subject: [PATCH 7/7] include unistd.h to fix macos build --- deps/zlib/gzguts.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/deps/zlib/gzguts.h b/deps/zlib/gzguts.h index d87659d..fb91985 100644 --- a/deps/zlib/gzguts.h +++ b/deps/zlib/gzguts.h @@ -3,6 +3,8 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ +#include + #ifdef _LARGEFILE64_SOURCE # ifndef _LARGEFILE_SOURCE # define _LARGEFILE_SOURCE 1