Compare commits
5 Commits
dbe3001a12
...
7b0d4198f2
Author | SHA1 | Date |
---|---|---|
Mike Frysinger | 7b0d4198f2 | |
Mike Frysinger | 4bbfa00aee | |
Mike Frysinger | 946088ca07 | |
Christoph M. Becker | d4a3100ff3 | |
Khem Raj | 7dae724967 |
49
configure.ac
49
configure.ac
|
@ -1,7 +1,7 @@
|
|||
# Process this file with autoconf to produce a configure script.
|
||||
# Configure template for gd library
|
||||
|
||||
AC_PREREQ(2.64)
|
||||
AC_PREREQ([2.69])
|
||||
|
||||
# We extract version numbers from src/versions.h
|
||||
define([gv],[config/getver.sh ]$1)
|
||||
|
@ -123,7 +123,7 @@ dnl $2 - GD feature name to track
|
|||
dnl $3 - lower case name for user
|
||||
dnl $4 - test for the feature
|
||||
dnl The test code should set gd_found_lib=yes to indicate success.
|
||||
m4_define([GD_LIB_CHECK], [dnl
|
||||
m4_define([_GD_LIB_CHECK], [dnl
|
||||
dnl Export the flag for the user to leverage. No other logic here.
|
||||
AC_MSG_CHECKING([whether to support $3])
|
||||
AC_ARG_WITH([$3],
|
||||
|
@ -179,22 +179,23 @@ m4_define([GD_LIB_CHECK], [dnl
|
|||
AM_CONDITIONAL([HAVE_$1], test "$gd_found_lib" = yes)
|
||||
gd_with_$1=$gd_found_lib
|
||||
])
|
||||
dnl Helper to avoid repeating m4_tolower() a lot.
|
||||
m4_define([GD_LIB_CHECK], [_GD_LIB_CHECK([$1], [$2], m4_tolower([$2]), [$3])])dnl
|
||||
|
||||
dnl Helper macro for working with external libraries with pkg-config support.
|
||||
dnl GD_LIB_PKG_CHECK([SYM], [FEATURE], [name], [pkg-config module], [...fallback test...])
|
||||
dnl GD_LIB_PKG_CHECK([SYM], [FEATURE], [pkg-config module], [...fallback test...])
|
||||
dnl $1 - upper case symbol
|
||||
dnl $2 - GD feature name to track
|
||||
dnl $3 - lower case name for user
|
||||
dnl $4 - pkg-config module to look for
|
||||
dnl $5 - fallback test for the feature
|
||||
dnl $3 - pkg-config module to look for
|
||||
dnl $4 - fallback test for the feature
|
||||
m4_define([GD_LIB_PKG_CHECK], [dnl
|
||||
GD_LIB_CHECK([$1], [$2], [$3], [dnl
|
||||
PKG_CHECK_MODULES([$1], [$4], [gd_found_lib=yes gd_require_pkg_name="$4"], [$5])
|
||||
GD_LIB_CHECK([$1], [$2], [dnl
|
||||
PKG_CHECK_MODULES([$1], [$3], [gd_found_lib=yes gd_require_pkg_name="$3"], [$4])
|
||||
])
|
||||
])
|
||||
|
||||
dnl Check for zlib support.
|
||||
GD_LIB_PKG_CHECK([LIBZ], [ZLIB], [zlib], [zlib], [dnl
|
||||
GD_LIB_PKG_CHECK([LIBZ], [ZLIB], [zlib], [dnl
|
||||
AC_CHECK_LIB([z], [deflate], [dnl
|
||||
AS_VAR_APPEND([LIBZ_LIBS], [" -lz"])
|
||||
gd_found_lib=yes
|
||||
|
@ -202,23 +203,31 @@ GD_LIB_PKG_CHECK([LIBZ], [ZLIB], [zlib], [zlib], [dnl
|
|||
])
|
||||
|
||||
dnl Check for libpng support.
|
||||
GD_LIB_PKG_CHECK([LIBPNG], [PNG], [png], [libpng], [
|
||||
GD_LIB_PKG_CHECK([LIBPNG], [PNG], [libpng], [
|
||||
LIBPNG_CONFIG=$gd_with_lib/bin/libpng-config
|
||||
AC_MSG_CHECKING([for $LIBPNG_CONFIG script])
|
||||
if test -e "$LIBPNG_CONFIG"; then
|
||||
LIBPNG_CFLAGS=`$LIBPNG_CONFIG --cflags`
|
||||
LIBPNG_LIBS=`$LIBPNG_CONFIG --ldflags`
|
||||
AC_MSG_RESULT(yes)
|
||||
gd_found_lib=yes
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
])
|
||||
|
||||
dnl Check for FreeType support.
|
||||
dnl NB: "9.8.3" corresponds to freetype-2.1.10.
|
||||
GD_LIB_PKG_CHECK([LIBFREETYPE], [FREETYPE], [freetype], [freetype2 >= 9.8.3], [
|
||||
GD_LIB_PKG_CHECK([LIBFREETYPE], [FREETYPE], [freetype2 >= 9.8.3], [
|
||||
FREETYPE_CONFIG=$gd_with_lib/bin/freetype-config
|
||||
AC_MSG_CHECKING([for $FREETYPE_CONFIG script])
|
||||
if test -e "$FREETYPE_CONFIG"; then
|
||||
LIBFREETYPE_CFLAGS=`$FREETYPE_CONFIG --cflags`
|
||||
LIBFREETYPE_LIBS=`$FREETYPE_CONFIG --libs`
|
||||
AC_MSG_RESULT(yes)
|
||||
gd_found_lib=yes
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
])
|
||||
if test "$gd_with_LIBFREETYPE" = "yes"; then
|
||||
|
@ -226,7 +235,7 @@ if test "$gd_with_LIBFREETYPE" = "yes"; then
|
|||
fi
|
||||
|
||||
dnl Check for Raqm support.
|
||||
GD_LIB_PKG_CHECK([LIBRAQM], [RAQM], [raqm], [raqm], [
|
||||
GD_LIB_PKG_CHECK([LIBRAQM], [RAQM], [raqm], [
|
||||
AC_CHECK_LIB([raqm], [raqm_create], [dnl
|
||||
AS_VAR_APPEND([LIBRAQM_LIBS], [" -lraqm -lfreetype"])
|
||||
gd_found_lib=yes
|
||||
|
@ -234,7 +243,7 @@ GD_LIB_PKG_CHECK([LIBRAQM], [RAQM], [raqm], [raqm], [
|
|||
])
|
||||
|
||||
dnl Check for fontconfig support.
|
||||
GD_LIB_PKG_CHECK([LIBFONTCONFIG], [FONTCONFIG], [fontconfig], [fontconfig], [
|
||||
GD_LIB_PKG_CHECK([LIBFONTCONFIG], [FONTCONFIG], [fontconfig], [
|
||||
AC_CHECK_LIB([fontconfig], [FcInit], [dnl
|
||||
AS_VAR_APPEND([LIBFONTCONFIG_LIBS], [" -lfontconfig"])
|
||||
gd_found_lib=yes
|
||||
|
@ -242,7 +251,7 @@ GD_LIB_PKG_CHECK([LIBFONTCONFIG], [FONTCONFIG], [fontconfig], [fontconfig], [
|
|||
])
|
||||
|
||||
dnl Check for jpeg support.
|
||||
GD_LIB_PKG_CHECK([LIBJPEG], [JPEG], [jpeg], [libjpeg], [
|
||||
GD_LIB_PKG_CHECK([LIBJPEG], [JPEG], [libjpeg], [
|
||||
AC_CHECK_LIB([jpeg], [jpeg_set_defaults], [dnl
|
||||
AS_VAR_APPEND([LIBJPEG_LIBS], [" -ljpeg"])
|
||||
gd_found_lib=yes
|
||||
|
@ -250,7 +259,7 @@ GD_LIB_PKG_CHECK([LIBJPEG], [JPEG], [jpeg], [libjpeg], [
|
|||
])
|
||||
|
||||
dnl Check for libimagequant support.
|
||||
GD_LIB_CHECK([LIBIMAGEQUANT], [LIQ], [liq], [
|
||||
GD_LIB_CHECK([LIBIMAGEQUANT], [LIQ], [
|
||||
AC_CHECK_HEADER([libimagequant.h], [
|
||||
save_CFLAGS=$CFLAGS
|
||||
CFLAGS="$CFLAGS $OPENMP_CFLAGS"
|
||||
|
@ -263,7 +272,7 @@ GD_LIB_CHECK([LIBIMAGEQUANT], [LIQ], [liq], [
|
|||
])
|
||||
|
||||
dnl Check for xpm support.
|
||||
GD_LIB_PKG_CHECK([LIBXPM], [XPM], [xpm], [xpm], [
|
||||
GD_LIB_PKG_CHECK([LIBXPM], [XPM], [xpm], [
|
||||
AC_CHECK_LIB([Xpm], [XpmReadFileToXpmImage], [dnl
|
||||
AS_VAR_APPEND([LIBXPM_LIBS], [" -lXpm"])
|
||||
gd_found_lib=yes
|
||||
|
@ -271,7 +280,7 @@ GD_LIB_PKG_CHECK([LIBXPM], [XPM], [xpm], [xpm], [
|
|||
])
|
||||
|
||||
dnl Check for tiff support.
|
||||
GD_LIB_PKG_CHECK([LIBTIFF], [TIFF], [tiff], [libtiff-4], [
|
||||
GD_LIB_PKG_CHECK([LIBTIFF], [TIFF], [libtiff-4], [
|
||||
AC_CHECK_LIB([tiff], [TIFFClientOpen], [dnl
|
||||
AS_VAR_APPEND([LIBTIFF_LIBS], [" -ltiff"])
|
||||
gd_found_lib=yes
|
||||
|
@ -279,7 +288,7 @@ GD_LIB_PKG_CHECK([LIBTIFF], [TIFF], [tiff], [libtiff-4], [
|
|||
])
|
||||
|
||||
dnl Check for webp support.
|
||||
GD_LIB_PKG_CHECK([LIBWEBP], [WEBP], [webp], [libwebp >= 0.2.0], [
|
||||
GD_LIB_PKG_CHECK([LIBWEBP], [WEBP], [libwebp >= 0.2.0], [
|
||||
AC_CHECK_LIB([webp], [WebPGetInfo], [dnl
|
||||
AS_VAR_APPEND([LIBWEBP_LIBS], [" -lwebp"])
|
||||
gd_found_lib=yes
|
||||
|
@ -287,14 +296,14 @@ GD_LIB_PKG_CHECK([LIBWEBP], [WEBP], [webp], [libwebp >= 0.2.0], [
|
|||
])
|
||||
|
||||
dnl Check for heif support.
|
||||
GD_LIB_PKG_CHECK([LIBHEIF], [HEIF], [heif], [libheif >= 1.7.0], [
|
||||
GD_LIB_PKG_CHECK([LIBHEIF], [HEIF], [libheif >= 1.7.0], [
|
||||
AC_CHECK_LIB([heif], [heif_get_version], [dnl
|
||||
AS_VAR_APPEND([LIBHEIF_LIBS], [" -lheif"])
|
||||
])
|
||||
])
|
||||
|
||||
dnl Check for avif support.
|
||||
GD_LIB_PKG_CHECK([LIBAVIF], [AVIF], [avif], [libavif >= 0.8.2], [
|
||||
GD_LIB_PKG_CHECK([LIBAVIF], [AVIF], [libavif >= 0.8.2], [
|
||||
AC_CHECK_LIB([avif], [avifVersion], [dnl
|
||||
AS_VAR_APPEND([LIBAVIF_LIBS], [" -lavif"])
|
||||
gd_found_lib=yes
|
||||
|
|
|
@ -112,12 +112,7 @@ typedef struct {
|
|||
|
||||
/* Initialise network in range (0,0,0,0) to (255,255,255,255) and set parameters
|
||||
----------------------------------------------------------------------- */
|
||||
static void initnet(nnq, thepic, len, sample, colours)
|
||||
nn_quant *nnq;
|
||||
unsigned char *thepic;
|
||||
int len;
|
||||
int sample;
|
||||
int colours;
|
||||
static void initnet(nn_quant *nnq, unsigned char *thepic, int len, int sample, int colours)
|
||||
{
|
||||
register int i;
|
||||
register int *p;
|
||||
|
@ -163,9 +158,7 @@ static void unbiasnet(nn_quant *nnq)
|
|||
}
|
||||
|
||||
/* Output colormap to unsigned char ptr in RGBA format */
|
||||
static void getcolormap(nnq, map)
|
||||
nn_quant *nnq;
|
||||
unsigned char *map;
|
||||
static void getcolormap(nn_quant *nnq, unsigned char *map)
|
||||
{
|
||||
int i,j;
|
||||
for(j=0; j < nnq->netsize; j++) {
|
||||
|
@ -232,9 +225,7 @@ static void inxbuild(nn_quant *nnq)
|
|||
|
||||
/* Search for ABGR values 0..255 (after net is unbiased) and return colour index
|
||||
---------------------------------------------------------------------------- */
|
||||
static unsigned int inxsearch(nnq, al,b,g,r)
|
||||
nn_quant *nnq;
|
||||
register int al, b, g, r;
|
||||
static unsigned int inxsearch(nn_quant *nnq, int al, int b, int g, int r)
|
||||
{
|
||||
register int i, j, dist, a, bestd;
|
||||
register int *p;
|
||||
|
@ -306,9 +297,7 @@ register int al, b, g, r;
|
|||
|
||||
/* Search for biased ABGR values
|
||||
---------------------------- */
|
||||
static int contest(nnq, al,b,g,r)
|
||||
nn_quant *nnq;
|
||||
register int al,b,g,r;
|
||||
static int contest(nn_quant *nnq, int al, int b, int g, int r)
|
||||
{
|
||||
/* finds closest neuron (min dist) and updates freq */
|
||||
/* finds best neuron (min dist-bias) and returns position */
|
||||
|
@ -362,9 +351,7 @@ register int al,b,g,r;
|
|||
/* Move neuron i towards biased (a,b,g,r) by factor alpha
|
||||
---------------------------------------------------- */
|
||||
|
||||
static void altersingle(nnq, alpha,i,al,b,g,r)
|
||||
nn_quant *nnq;
|
||||
register int alpha,i,al,b,g,r;
|
||||
static void altersingle(nn_quant *nnq, int alpha, int i, int al, int b, int g, int r)
|
||||
{
|
||||
register int *n;
|
||||
|
||||
|
@ -382,10 +369,7 @@ register int alpha,i,al,b,g,r;
|
|||
/* Move adjacent neurons by precomputed alpha*(1-((i-j)^2/[r]^2)) in radpower[|i-j|]
|
||||
--------------------------------------------------------------------------------- */
|
||||
|
||||
static void alterneigh(nnq, rad,i,al,b,g,r)
|
||||
nn_quant *nnq;
|
||||
int rad,i;
|
||||
register int al,b,g,r;
|
||||
static void alterneigh(nn_quant *nnq, int rad, int i, int al, int b,int g, int r)
|
||||
{
|
||||
register int j,k,lo,hi,a;
|
||||
register int *p, *q;
|
||||
|
@ -429,9 +413,7 @@ register int al,b,g,r;
|
|||
/* Main Learning Loop
|
||||
------------------ */
|
||||
|
||||
static void learn(nnq, verbose) /* Stu: N.B. added parameter so that main() could control verbosity. */
|
||||
nn_quant *nnq;
|
||||
int verbose;
|
||||
static void learn(nn_quant *nnq, int verbose) /* Stu: N.B. added parameter so that main() could control verbosity. */
|
||||
{
|
||||
register int i,j,al,b,g,r;
|
||||
int radius,rad,alpha,step,delta,samplepixels;
|
||||
|
|
|
@ -446,9 +446,7 @@ BGD_DECLARE(void) gdImageTiffCtx(gdImagePtr image, gdIOCtx *out)
|
|||
}
|
||||
|
||||
/* Check if we are really in 8bit mode */
|
||||
static int checkColorMap(n, r, g, b)
|
||||
int n;
|
||||
uint16_t *r, *g, *b;
|
||||
static int checkColorMap(int n, uint16_t *r, uint16_t *g, uint16_t *b)
|
||||
{
|
||||
while (n-- > 0)
|
||||
if (*r++ >= 256 || *g++ >= 256 || *b++ >= 256)
|
||||
|
|
Loading…
Reference in New Issue