summaryrefslogtreecommitdiff
path: root/Build/source/libs/libpng/libpng-1.6.1/contrib/tools
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/libpng/libpng-1.6.1/contrib/tools')
-rw-r--r--Build/source/libs/libpng/libpng-1.6.1/contrib/tools/README.txt26
-rw-r--r--Build/source/libs/libpng/libpng-1.6.1/contrib/tools/checksum-icc.c102
-rwxr-xr-xBuild/source/libs/libpng/libpng-1.6.1/contrib/tools/chkfmt137
-rw-r--r--Build/source/libs/libpng/libpng-1.6.1/contrib/tools/cvtcolor.c188
-rw-r--r--Build/source/libs/libpng/libpng-1.6.1/contrib/tools/intgamma.sh110
-rw-r--r--Build/source/libs/libpng/libpng-1.6.1/contrib/tools/makesRGB.c430
-rw-r--r--Build/source/libs/libpng/libpng-1.6.1/contrib/tools/sRGB.h48
7 files changed, 0 insertions, 1041 deletions
diff --git a/Build/source/libs/libpng/libpng-1.6.1/contrib/tools/README.txt b/Build/source/libs/libpng/libpng-1.6.1/contrib/tools/README.txt
deleted file mode 100644
index 5ddae02ce9b..00000000000
--- a/Build/source/libs/libpng/libpng-1.6.1/contrib/tools/README.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-This directory (contrib/tools) contains tools used by the authors of libpng.
-
-Code and data placed in this directory is not required to build libpng,
-however the code in this directory has been used to generate data or code in
-the body of the libpng source. The source code identifies where this has
-been done. Code in this directory may not compile on all operating systems
-that libpng supports.
-
-NO COPYRIGHT RIGHTS ARE CLAIMED TO ANY OF THE FILES IN THIS DIRECTORY.
-
-To the extent possible under law, the authors have waived all copyright and
-related or neighboring rights to this work. This work is published from:
-United States.
-
-The files may be used freely in any way.
-
-The source code and comments in this directory are the original work of the
-people named below. No other person or organization has made contributions to
-the work in this directory.
-
-ORIGINAL AUTHORS
- The following people have contributed to the code in this directory. None
- of the people below claim any rights with regard to the contents of this
- directory.
-
- John Bowler <jbowler@acm.org>
diff --git a/Build/source/libs/libpng/libpng-1.6.1/contrib/tools/checksum-icc.c b/Build/source/libs/libpng/libpng-1.6.1/contrib/tools/checksum-icc.c
deleted file mode 100644
index 581e7088a62..00000000000
--- a/Build/source/libs/libpng/libpng-1.6.1/contrib/tools/checksum-icc.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/* checksum-icc.c
- *
- * Copyright (c) 2013 John Cunningham Bowler
- *
- * Last changed in libpng 1.6.0 [February 14, 2013]
- *
- * This code is released under the libpng license.
- * For conditions of distribution and use, see the disclaimer
- * and license in png.h
- *
- * Generate crc32 and adler32 checksums of the given input files, used to
- * generate check-codes for use when matching ICC profiles within libpng.
- */
-#include <stdio.h>
-
-#include <zlib.h>
-
-static int
-read_one_file(FILE *ip, const char *name)
-{
- uLong length = 0;
- uLong a32 = adler32(0, NULL, 0);
- uLong c32 = crc32(0, NULL, 0);
- Byte header[132];
-
- for (;;)
- {
- int ch = getc(ip);
- Byte b;
-
- if (ch == EOF) break;
-
- b = (Byte)ch;
-
- if (length < sizeof header)
- header[length] = b;
-
- ++length;
- a32 = adler32(a32, &b, 1);
- c32 = crc32(c32, &b, 1);
- }
-
- if (ferror(ip))
- return 0;
-
- /* Success */
- printf("PNG_ICC_CHECKSUM(0x%8.8lx, 0x%8.8lx,\n PNG_MD5("
- "0x%2.2x%2.2x%2.2x%2.2x, 0x%2.2x%2.2x%2.2x%2.2x, 0x%2.2x%2.2x%2.2x%2.2x,"
- " 0x%2.2x%2.2x%2.2x%2.2x), %d,\n"
- " \"%4.4d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d\", %lu, \"%s\")\n",
- (unsigned long)a32, (unsigned long)c32,
- header[84], header[85], header[86], header[87],
- header[88], header[89], header[90], header[91],
- header[92], header[93], header[94], header[95],
- header[96], header[97], header[98], header[99],
-# define u16(x) (header[x] * 256 + header[x+1])
-# define u32(x) (u16(x) * 65536 + u16(x+2))
- u32(64), u16(24), u16(26), u16(28), u16(30), u16(32), u16(34),
- (unsigned long)length, name);
-
- return 1;
-}
-
-int main(int argc, char **argv)
-{
- int err = 0;
-
- printf("/* adler32, crc32, MD5[16], intent, date, length, file-name */\n");
-
- if (argc > 1)
- {
- int i;
-
- for (i=1; i<argc; ++i)
- {
- FILE *ip = fopen(argv[i], "rb");
-
- if (ip == NULL || !read_one_file(ip, argv[i]))
- {
- err = 1;
- perror(argv[i]);
- fprintf(stderr, "%s: read error\n", argv[i]);
- printf("/* ERROR: %s */\n", argv[i]);
- }
-
- (void)fclose(ip);
- }
- }
-
- else
- {
- if (!read_one_file(stdin, "-"))
- {
- err = 1;
- perror("stdin");
- fprintf(stderr, "stdin: read error\n");
- printf("/* ERROR: stdin */\n");
- }
- }
-
- return err;
-}
diff --git a/Build/source/libs/libpng/libpng-1.6.1/contrib/tools/chkfmt b/Build/source/libs/libpng/libpng-1.6.1/contrib/tools/chkfmt
deleted file mode 100755
index 9da6475fd4e..00000000000
--- a/Build/source/libs/libpng/libpng-1.6.1/contrib/tools/chkfmt
+++ /dev/null
@@ -1,137 +0,0 @@
-#!/bin/sh
-#
-# Check the format of the source files in the current directory - checks for a
-# line length of 80 characters max and no tab characters.
-#
-# Optionally arguments are files or directories to check.
-#
-# -v: output the long lines (makes fixing them easier)
-# -e: spawn an editor for each file that needs a change ($EDITOR must be
-# defined). When using -e the script MUST be run from an interactive
-# command line.
-verbose=
-edit=
-vers=
-test "$1" = "-v" && {
- shift
- verbose=yes
-}
-test "$1" = "-e" && {
- shift
- if test -n "$EDITOR"
- then
- edit=yes
-
- # Copy the standard streams for the editor
- exec 3>&0 4>&1 5>&2
- else
- echo "chkfmt -e: EDITOR must be defined" >&2
- exit 1
- fi
-}
-
-# Function to edit a single file - if the file isn't changed ask the user
-# whether or not to continue. This stuff only works if the script is run from
-# the command line (otherwise, don't specify -e or you will be sorry).
-doed(){
- cp "$file" "$file".orig
- "$EDITOR" "$file" 0>&3 1>&4 2>&5 3>&- 4>&- 5>&- || exit 1
- if cmp -s "$file".orig "$file"
- then
- rm "$file".orig
- echo -n "$file: file not changed, type anything to continue: " >&5
- read ans 0>&3
- test -n "$ans" || return 1
- fi
- return 0
-}
-
-# In beta versions the version string which appears in files can be a little
-# long and cause spuriously overlong lines. To avoid this subtitute the version
-# string with a 'standard' version a.b.cc before checking for long lines.
-if test -r png.h
-then
- vers="`sed -n -e \
- 's/^#define PNG_LIBPNG_VER_STRING .\([0-9]\.[0-9]\.[0-9][0-9a-z]*\).$/\1/p' \
- png.h`"
- echo "chkfmt: checking version $vers"
-fi
-if test -z "$vers"
-then
- echo "chkfmt: png.h not found, ignoring version number" >&2
-fi
-
-test -n "$1" || set -- .
-find "$@" \( -type d \( -name '.git' -o -name '.libs' -o -name 'projects' \) \
- -prune \) -o \( -type f \
- ! -name '*.[oa]' ! -name '*.l[oa]' ! -name '*.png' ! -name '*.out' \
- ! -name '*.jpg' ! -name '*.patch' ! -name '*.obj' ! -name '*.exe' \
- ! -name '*.com' ! -name '*.tar.*' ! -name '*.zip' ! -name '*.ico' \
- ! -name '*.res' ! -name '*.rc' ! -name '*.mms' ! -name '*.rej' \
- ! -name '*.dsp' ! -name '*.orig' ! -name '*.dfn' ! -name '*.swp' \
- ! -name '~*' ! -name '*.3' \
- ! -name 'missing' ! -name 'mkinstalldirs' ! -name 'depcomp' \
- ! -name 'aclocal.m4' ! -name 'install-sh' ! -name 'Makefile.in' \
- ! -name 'ltmain.sh' ! -name 'config*' -print \) | {
- st=0
- while read file
- do
- case "$file" in
- *.mak|*[Mm]akefile.*|*[Mm]akefile)
- # Makefiles require tabs, dependency lines can be this long.
- check_tabs=
- line_length=100;;
- *.awk)
- # Includes literal tabs
- check_tabs=
- # The following is arbitrary
- line_length=132;;
- *contrib/*/*.[ch])
- check_tabs=yes
- line_length=96;;
- *)
- check_tabs=yes
- line_length=80;;
- esac
-
- # Note that vers can only contain 0-9, . and a-z
- if test -n "$vers"
- then
- sed -e "s/$vers/a.b.cc/g" "$file" >"$file".$$
- else
- cp "$file" "$file".$$
- fi
- splt="`fold -$line_length "$file".$$ | diff -c "$file".$$ -`"
- rm "$file".$$
-
- if test -n "$splt"
- then
- echo "$file: lines too long"
- st=1
- if test -n "$EDITOR" -a -n "$edit"
- then
- doed "$file" || exit 1
- elif test -n "$verbose"
- then
- echo "$splt"
- fi
- fi
- if test -n "$check_tabs"
- then
- tab="`tr -c -d '\t' <"$file"`"
- if test -n "$tab"
- then
- echo "$file: file contains tab characters"
- st=1
- if test -n "$EDITOR" -a -n "$edit"
- then
- doed "$file" || exit 1
- elif test -n "$verbose"
- then
- echo "$splt"
- fi
- fi
- fi
- done
- exit $st
-}
diff --git a/Build/source/libs/libpng/libpng-1.6.1/contrib/tools/cvtcolor.c b/Build/source/libs/libpng/libpng-1.6.1/contrib/tools/cvtcolor.c
deleted file mode 100644
index e6793c7d596..00000000000
--- a/Build/source/libs/libpng/libpng-1.6.1/contrib/tools/cvtcolor.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/*-
- * convert.c
- *
- * Last changed in libpng 1.6.0 [February 14, 2013]
- *
- * COPYRIGHT: Written by John Cunningham Bowler, 2013.
- * To the extent possible under law, the author has waived all copyright and
- * related or neighboring rights to this work. This work is published from:
- * United States.
- *
- * Convert 8-bit sRGB or 16-bit linear values to another format.
- */
-#define _ISOC99_SOURCE 1
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <stdio.h>
-
-#include <fenv.h>
-
-#include "sRGB.h"
-
-static void
-usage(const char *prog)
-{
- fprintf(stderr,
- "%s: usage: %s [-linear|-sRGB] [-gray|-color] component{1,4}\n",
- prog, prog);
- exit(1);
-}
-
-unsigned long
-component(const char *prog, const char *arg, int issRGB)
-{
- char *ep;
- unsigned long c = strtoul(arg, &ep, 0);
-
- if (ep <= arg || *ep || c > 65535 || (issRGB && c > 255))
- {
- fprintf(stderr, "%s: %s: invalid component value (%lu)\n", prog, arg, c);
- usage(prog);
- }
-
- return c;
-}
-
-int
-main(int argc, const char **argv)
-{
- const char *prog = *argv++;
- int to_linear = 0, to_gray = 0, to_color = 0;
- int channels = 0;
- double c[4];
-
- /* FE_TONEAREST is the IEEE754 round to nearest, preferring even, mode; i.e.
- * everything rounds to the nearest value except that '.5' rounds to the
- * nearest even value.
- */
- fesetround(FE_TONEAREST);
-
- c[3] = c[2] = c[1] = c[0] = 0;
-
- while (--argc > 0 && **argv == '-')
- {
- const char *arg = 1+*argv++;
-
- if (strcmp(arg, "sRGB") == 0)
- to_linear = 0;
-
- else if (strcmp(arg, "linear") == 0)
- to_linear = 1;
-
- else if (strcmp(arg, "gray") == 0)
- to_gray = 1, to_color = 0;
-
- else if (strcmp(arg, "color") == 0)
- to_gray = 0, to_color = 1;
-
- else
- usage(prog);
- }
-
- switch (argc)
- {
- default:
- usage(prog);
- break;
-
- case 4:
- c[3] = component(prog, argv[3], to_linear);
- ++channels;
- case 3:
- c[2] = component(prog, argv[2], to_linear);
- ++channels;
- case 2:
- c[1] = component(prog, argv[1], to_linear);
- ++channels;
- case 1:
- c[0] = component(prog, argv[0], to_linear);
- ++channels;
- break;
- }
-
- if (to_linear)
- {
- int i;
- int components = channels;
-
- if ((components & 1) == 0)
- --components;
-
- for (i=0; i<components; ++i) c[i] = linear_from_sRGB(c[i] / 255);
- if (components < channels)
- c[components] = c[components] / 255;
- }
-
- else
- {
- int i;
- for (i=0; i<4; ++i) c[i] /= 65535;
-
- if ((channels & 1) == 0)
- {
- double alpha = c[channels-1];
-
- if (alpha > 0)
- for (i=0; i<channels-1; ++i) c[i] /= alpha;
- else
- for (i=0; i<channels-1; ++i) c[i] = 1;
- }
- }
-
- if (to_gray)
- {
- if (channels < 3)
- {
- fprintf(stderr, "%s: too few channels (%d) for -gray\n",
- prog, channels);
- usage(prog);
- }
-
- c[0] = YfromRGB(c[0], c[1], c[2]);
- channels -= 2;
- }
-
- if (to_color)
- {
- if (channels > 2)
- {
- fprintf(stderr, "%s: too many channels (%d) for -color\n",
- prog, channels);
- usage(prog);
- }
-
- c[3] = c[1]; /* alpha, if present */
- c[2] = c[1] = c[0];
- }
-
- if (to_linear)
- {
- int i;
- if ((channels & 1) == 0)
- {
- double alpha = c[channels-1];
- for (i=0; i<channels-1; ++i) c[i] *= alpha;
- }
-
- for (i=0; i<channels; ++i) c[i] = nearbyint(c[i] * 65535);
- }
-
- else /* to sRGB */
- {
- int i = (channels+1)&~1;
- while (--i >= 0)
- c[i] = sRGB_from_linear(c[i]);
-
- for (i=0; i<channels; ++i) c[i] = nearbyint(c[i] * 255);
- }
-
- {
- int i;
- for (i=0; i<channels; ++i) printf(" %g", c[i]);
- }
- printf("\n");
-
- return 0;
-}
diff --git a/Build/source/libs/libpng/libpng-1.6.1/contrib/tools/intgamma.sh b/Build/source/libs/libpng/libpng-1.6.1/contrib/tools/intgamma.sh
deleted file mode 100644
index 41c5d6dd278..00000000000
--- a/Build/source/libs/libpng/libpng-1.6.1/contrib/tools/intgamma.sh
+++ /dev/null
@@ -1,110 +0,0 @@
-#!/bin/sh
-#
-# intgamma.sh
-#
-# Last changed in libpng 1.6.0 [February 14, 2013]
-#
-# COPYRIGHT: Written by John Cunningham Bowler, 2013.
-# To the extent possible under law, the author has waived all copyright and
-# related or neighboring rights to this work. This work is published from:
-# United States.
-#
-# Shell script to generate png.c 8-bit and 16-bit log tables (see the code in
-# png.c for details).
-#
-# This script uses the "bc" arbitrary precision calculator to calculate 32-bit
-# fixed point values of logarithms appropriate to finding the log of an 8-bit
-# (0..255) value and a similar table for the exponent calculation.
-#
-# "bc" must be on the path when the script is executed, and the math library
-# (-lm) must be available
-#
-# function to print out a list of numbers as integers; the function truncates
-# the integers which must be one-per-line
-function print(){
- awk 'BEGIN{
- str = ""
- }
- {
- sub("\\.[0-9]*$", "")
- if ($0 == "")
- $0 = "0"
-
- if (str == "")
- t = " " $0 "U"
- else
- t = str ", " $0 "U"
-
- if (length(t) >= 80) {
- print str ","
- str = " " $0 "U"
- } else
- str = t
- }
- END{
- print str
- }'
-}
-#
-# The logarithm table.
-cat <<END
-/* 8-bit log table: png_8bit_l2[128]
- * This is a table of -log(value/255)/log(2) for 'value' in the range 128 to
- * 255, so it's the base 2 logarithm of a normalized 8-bit floating point
- * mantissa. The numbers are 32-bit fractions.
- */
-static const png_uint_32
-png_8bit_l2[128] =
-{
-END
-#
-bc -lqws <<END | print
-f=65536*65536/l(2)
-for (i=128;i<256;++i) { .5 - l(i/255)*f; }
-END
-echo '};'
-echo
-#
-# The exponent table.
-cat <<END
-/* The 'exp()' case must invert the above, taking a 20-bit fixed point
- * logarithmic value and returning a 16 or 8-bit number as appropriate. In
- * each case only the low 16 bits are relevant - the fraction - since the
- * integer bits (the top 4) simply determine a shift.
- *
- * The worst case is the 16-bit distinction between 65535 and 65534; this
- * requires perhaps spurious accuracy in the decoding of the logarithm to
- * distinguish log2(65535/65534.5) - 10^-5 or 17 bits. There is little chance
- * of getting this accuracy in practice.
- *
- * To deal with this the following exp() function works out the exponent of the
- * frational part of the logarithm by using an accurate 32-bit value from the
- * top four fractional bits then multiplying in the remaining bits.
- */
-static const png_uint_32
-png_32bit_exp[16] =
-{
-END
-#
-bc -lqws <<END | print
-f=l(2)/16
-for (i=0;i<16;++i) {
- x = .5 + e(-i*f)*2^32;
- if (x >= 2^32) x = 2^32-1;
- x;
-}
-END
-echo '};'
-echo
-#
-# And the table of adjustment values.
-cat <<END
-/* Adjustment table; provided to explain the numbers in the code below. */
-#if 0
-END
-bc -lqws <<END | awk '{ printf "%5d %s\n", 12-NR, $0 }'
-for (i=11;i>=0;--i){
- (1 - e(-(2^i)/65536*l(2))) * 2^(32-i)
-}
-END
-echo '#endif'
diff --git a/Build/source/libs/libpng/libpng-1.6.1/contrib/tools/makesRGB.c b/Build/source/libs/libpng/libpng-1.6.1/contrib/tools/makesRGB.c
deleted file mode 100644
index e66c9f1576b..00000000000
--- a/Build/source/libs/libpng/libpng-1.6.1/contrib/tools/makesRGB.c
+++ /dev/null
@@ -1,430 +0,0 @@
-/* makesRGB.c -- build sRGB-to-linear and linear-to-sRGB conversion tables
- *
- * Last changed in libpng 1.6.0 [February 14, 2013]
- *
- * COPYRIGHT: Written by John Cunningham Bowler, 2013.
- * To the extent possible under law, the author has waived all copyright and
- * related or neighboring rights to this work. This work is published from:
- * United States.
- *
- * Make a table to convert 8-bit sRGB encoding values into the closest 16-bit
- * linear value.
- *
- * Make two tables to take a linear value scaled to 255*65535 and return an
- * approximation to the 8-bit sRGB encoded value. Calculate the error in these
- * tables and display it.
- */
-#define _C99_SOURCE 1
-#include <stdio.h>
-#include <math.h>
-#include <stdlib.h>
-
-/* pngpriv.h includes the definition of 'PNG_sRGB_FROM_LINEAR' which is required
- * to verify the actual code.
- */
-#include "../../pngpriv.h"
-
-#include "sRGB.h"
-
-/* The tables are declared 'const' in pngpriv.h, so this redefines the tables to
- * be used.
- */
-#define png_sRGB_table sRGB_table
-#define png_sRGB_base sRGB_base
-#define png_sRGB_delta sRGB_delta
-
-static png_uint_16 png_sRGB_table[256];
-static png_uint_16 png_sRGB_base[512];
-static png_byte png_sRGB_delta[512];
-
-static const unsigned int max_input = 255*65535;
-
-double
-fsRGB(double l)
-{
- return sRGB_from_linear(l/max_input);
-}
-
-double
-sRGB(unsigned int i)
-{
- return fsRGB(i);
-}
-
-double
-finvsRGB(unsigned int i)
-{
- return 65535 * linear_from_sRGB(i/255.);
-}
-
-png_uint_16
-invsRGB(unsigned int i)
-{
- unsigned int x = nearbyint(finvsRGB(i));
-
- if (x > 65535)
- {
- fprintf(stderr, "invsRGB(%u) overflows to %u\n", i, x);
- exit(1);
- }
-
- return (png_uint_16)x;
-}
-
-int
-main(int argc, char **argv)
-{
- unsigned int i, i16, ibase;
- double min_error = 0;
- double max_error = 0;
- double min_error16 = 0;
- double max_error16 = 0;
- double adjust;
- double adjust_lo = 0.4, adjust_hi = 0.6, adjust_mid = 0.5;
- unsigned int ec_lo = 0, ec_hi = 0, ec_mid = 0;
- unsigned int error_count = 0;
- unsigned int error_count16 = 0;
- int test_only = 0;
-
- if (argc > 1)
- test_only = strcmp("--test", argv[1]) == 0;
-
- /* Initialize the encoding table first. */
- for (i=0; i<256; ++i)
- {
- png_sRGB_table[i] = invsRGB(i);
- }
-
- /* Now work out the decoding tables (this is where the error comes in because
- * there are 512 set points and 512 straight lines between them.)
- */
- for (;;)
- {
- if (ec_lo == 0)
- adjust = adjust_lo;
-
- else if (ec_hi == 0)
- adjust = adjust_hi;
-
- else if (ec_mid == 0)
- adjust = adjust_mid;
-
- else if (ec_mid < ec_hi)
- adjust = (adjust_mid + adjust_hi)/2;
-
- else if (ec_mid < ec_lo)
- adjust = (adjust_mid + adjust_lo)/2;
-
- else
- {
- fprintf(stderr, "not reached: %u .. %u .. %u\n", ec_lo, ec_mid, ec_hi);
- exit(1);
- }
-
- /* Calculate the table using the current 'adjust' */
- for (i=0; i<=511; ++i)
- {
- double lo = 255 * sRGB(i << 15);
- double hi = 255 * sRGB((i+1) << 15);
- unsigned int calc;
-
- calc = nearbyint((lo+adjust) * 256);
- if (calc > 65535)
- {
- fprintf(stderr, "table[%d][0]: overflow %08x (%d)\n", i, calc,
- calc);
- exit(1);
- }
- png_sRGB_base[i] = calc;
-
- calc = nearbyint((hi-lo) * 32);
- if (calc > 255)
- {
- fprintf(stderr, "table[%d][1]: overflow %08x (%d)\n", i, calc,
- calc);
- exit(1);
- }
- png_sRGB_delta[i] = calc;
- }
-
- /* Check the 16-bit linear values alone: */
- error_count16 = 0;
- for (i16=0; i16 <= 65535; ++i16)
- {
- unsigned int i = 255*i16;
- unsigned int iexact = nearbyint(255*sRGB(i));
- unsigned int icalc = PNG_sRGB_FROM_LINEAR(i);
-
- if (icalc != iexact)
- ++error_count16;
- }
-
- /* Now try changing the adjustment. */
- if (ec_lo == 0)
- ec_lo = error_count16;
-
- else if (ec_hi == 0)
- ec_hi = error_count16;
-
- else if (ec_mid == 0)
- {
- ec_mid = error_count16;
- printf("/* initial error counts: %u .. %u .. %u */\n", ec_lo, ec_mid,
- ec_hi);
- }
-
- else if (error_count16 < ec_mid)
- {
- printf("/* adjust (mid ): %f: %u -> %u */\n", adjust, ec_mid,
- error_count16);
- ec_mid = error_count16;
- adjust_mid = adjust;
- }
-
- else if (adjust < adjust_mid && error_count16 < ec_lo)
- {
- printf("/* adjust (low ): %f: %u -> %u */\n", adjust, ec_lo,
- error_count16);
- ec_lo = error_count16;
- adjust_lo = adjust;
- }
-
- else if (adjust > adjust_mid && error_count16 < ec_hi)
- {
- printf("/* adjust (high): %f: %u -> %u */\n", adjust, ec_hi,
- error_count16);
- ec_hi = error_count16;
- adjust_hi = adjust;
- }
-
- else
- {
- adjust = adjust_mid;
- printf("/* adjust: %f: %u */\n", adjust, ec_mid);
- break;
- }
- }
-
- /* For each entry in the table try to adjust it to minimize the error count
- * in that entry. Each entry corresponds to 128 input values.
- */
- for (ibase=0; ibase<65536; ibase+=128)
- {
- png_uint_16 base = png_sRGB_base[ibase >> 7], trybase = base, ob=base;
- png_byte delta = png_sRGB_delta[ibase >> 7], trydelta = delta, od=delta;
- unsigned int ecbase = 0, eco;
-
- for (;;)
- {
- png_sRGB_base[ibase >> 7] = trybase;
- png_sRGB_delta[ibase >> 7] = trydelta;
-
- /* Check the 16-bit linear values alone: */
- error_count16 = 0;
- for (i16=ibase; i16 < ibase+128; ++i16)
- {
- unsigned int i = 255*i16;
- unsigned int iexact = nearbyint(255*sRGB(i));
- unsigned int icalc = PNG_sRGB_FROM_LINEAR(i);
-
- if (icalc != iexact)
- ++error_count16;
- }
-
- if (error_count16 == 0)
- break;
-
- if (ecbase == 0)
- {
- eco = ecbase = error_count16;
- ++trybase; /* First test */
- }
-
- else if (error_count16 < ecbase)
- {
- if (trybase > base)
- {
- base = trybase;
- ++trybase;
- }
- else if (trybase < base)
- {
- base = trybase;
- --trybase;
- }
- else if (trydelta > delta)
- {
- delta = trydelta;
- ++trydelta;
- }
- else if (trydelta < delta)
- {
- delta = trydelta;
- --trydelta;
- }
- else
- {
- fprintf(stderr, "makesRGB: impossible\n");
- exit(1);
- }
- ecbase = error_count16;
- }
-
- else
- {
- if (trybase > base)
- trybase = base-1;
- else if (trybase < base)
- {
- trybase = base;
- ++trydelta;
- }
- else if (trydelta > delta)
- trydelta = delta-1;
- else if (trydelta < delta)
- break; /* end of tests */
- }
- }
-
- png_sRGB_base[ibase >> 7] = base;
- png_sRGB_delta[ibase >> 7] = delta;
- if (base != ob || delta != od)
- {
- printf("/* table[%u]={%u,%u} -> {%u,%u} %u -> %u errors */\n",
- ibase>>7, ob, od, base, delta, eco, ecbase);
- }
- else if (0)
- printf("/* table[%u]={%u,%u} %u errors */\n", ibase>>7, ob, od,
- ecbase);
- }
-
- /* Only do the full (slow) test at the end: */
- min_error = -.4999;
- max_error = .4999;
- error_count = 0;
-
- for (i=0; i <= max_input; ++i)
- {
- unsigned int iexact = nearbyint(255*sRGB(i));
- unsigned int icalc = PNG_sRGB_FROM_LINEAR(i);
-
- if (icalc != iexact)
- {
- double err = 255*sRGB(i) - icalc;
-
- if (err > (max_error+.001) || err < (min_error-.001))
- {
- printf(
- "/* 0x%08x: exact: %3d, got: %3d [tables: %08x, %08x] (%f) */\n",
- i, iexact, icalc, png_sRGB_base[i>>15],
- png_sRGB_delta[i>>15], err);
- }
-
- ++error_count;
- if (err > max_error)
- max_error = err;
- else if (err < min_error)
- min_error = err;
- }
- }
-
- /* Re-check the 16-bit cases too, including the warning if there is an error
- * bigger than 1.
- */
- error_count16 = 0;
- max_error16 = 0;
- min_error16 = 0;
- for (i16=0; i16 <= 65535; ++i16)
- {
- unsigned int i = 255*i16;
- unsigned int iexact = nearbyint(255*sRGB(i));
- unsigned int icalc = PNG_sRGB_FROM_LINEAR(i);
-
- if (icalc != iexact)
- {
- double err = 255*sRGB(i) - icalc;
-
- ++error_count16;
- if (err > max_error16)
- max_error16 = err;
- else if (err < min_error16)
- min_error16 = err;
-
- if (abs(icalc - iexact) > 1)
- printf(
- "/* 0x%04x: exact: %3d, got: %3d [tables: %08x, %08x] (%f) */\n",
- i16, iexact, icalc, png_sRGB_base[i>>15],
- png_sRGB_delta[i>>15], err);
- }
- }
-
- /* Check the round trip for each 8-bit sRGB value. */
- for (i16=0; i16 <= 255; ++i16)
- {
- unsigned int i = 255 * png_sRGB_table[i16];
- unsigned int iexact = nearbyint(255*sRGB(i));
- unsigned int icalc = PNG_sRGB_FROM_LINEAR(i);
-
- if (i16 != iexact)
- {
- fprintf(stderr, "8-bit rounding error: %d -> %d\n", i16, iexact);
- exit(1);
- }
-
- if (icalc != i16)
- {
- double finv = finvsRGB(i16);
-
- printf("/* 8-bit roundtrip error: %d -> %f -> %d(%f) */\n",
- i16, finv, icalc, fsRGB(255*finv));
- }
- }
-
-
- printf("/* error: %g - %g, %u (%g%%) of readings inexact */\n",
- min_error, max_error, error_count, (100.*error_count)/max_input);
- printf("/* 16-bit error: %g - %g, %u (%g%%) of readings inexact */\n",
- min_error16, max_error16, error_count16, (100.*error_count16)/65535);
-
- if (!test_only)
- {
- printf("PNG_CONST png_uint_16 png_sRGB_table[256] =\n{\n ");
- for (i=0; i<255; )
- {
- do
- {
- printf("%d,", png_sRGB_table[i++]);
- }
- while ((i & 0x7) != 0 && i<255);
- if (i<255) printf("\n ");
- }
- printf("%d\n};\n\n", png_sRGB_table[i]);
-
-
- printf("PNG_CONST png_uint_16 png_sRGB_base[512] =\n{\n ");
- for (i=0; i<511; )
- {
- do
- {
- printf("%d,", png_sRGB_base[i++]);
- }
- while ((i & 0x7) != 0 && i<511);
- if (i<511) printf("\n ");
- }
- printf("%d\n};\n\n", png_sRGB_base[i]);
-
- printf("PNG_CONST png_byte png_sRGB_delta[512] =\n{\n ");
- for (i=0; i<511; )
- {
- do
- {
- printf("%d,", png_sRGB_delta[i++]);
- }
- while ((i & 0xf) != 0 && i<511);
- if (i<511) printf("\n ");
- }
- printf("%d\n};\n\n", png_sRGB_delta[i]);
- }
-
- return 0;
-}
diff --git a/Build/source/libs/libpng/libpng-1.6.1/contrib/tools/sRGB.h b/Build/source/libs/libpng/libpng-1.6.1/contrib/tools/sRGB.h
deleted file mode 100644
index 22c8f7c0e3d..00000000000
--- a/Build/source/libs/libpng/libpng-1.6.1/contrib/tools/sRGB.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * sRGB.h
- *
- * Last changed in libpng 1.6.0 [February 14, 2013]
- *
- * COPYRIGHT: Written by John Cunningham Bowler, 2013.
- * To the extent possible under law, the author has waived all copyright and
- * related or neighboring rights to this work. This work is published from:
- * United States.
- *
- * Utility file; not actually a header, this contains definitions of sRGB
- * calculation functions for inclusion in those test programs that need them.
- *
- * All routines take and return a floating point value in the range
- * 0 to 1.0, doing a calculation according to the sRGB specification
- * (in fact the source of the numbers is the wikipedia article at
- * http://en.wikipedia.org/wiki/SRGB).
- */
-static double
-sRGB_from_linear(double l)
-{
- if (l <= 0.0031308)
- l *= 12.92;
-
- else
- l = 1.055 * pow(l, 1/2.4) - 0.055;
-
- return l;
-}
-
-static double
-linear_from_sRGB(double s)
-{
- if (s <= 0.04045)
- return s / 12.92;
-
- else
- return pow((s+0.055)/1.055, 2.4);
-}
-
-static double
-YfromRGB(double r, double g, double b)
-{
- /* Use the sRGB (rounded) coefficients for Rlinear, Glinear, Blinear to get
- * the CIE Y value (also linear).
- */
- return 0.2126 * r + 0.7152 * g + 0.0722 * b;
-}