Merge remote-tracking branch 'origin/master' into newmaxmin

Conflicts:
	TODO
This commit is contained in:
John Cupitt 2012-12-04 12:49:04 +00:00
commit 7a202cf95e
7 changed files with 202 additions and 191 deletions

View File

@ -22,6 +22,8 @@
- vipsthumbnail -o allows absolute file names
- much better exif handling for jpg images (thanks Gary)
- preserve jpeg app13 (photoshop ipct)
- nearest neighbour goes back to round down ... round to nearest caused a
range of annoying problems, such as strange half-pixels along edges
14/11/12 started 7.30.6
- capture tiff warnings earlier

8
TODO
View File

@ -1,3 +1,11 @@
- now we've removed round-to-nearest from NN, we need something extra in the
affine transform to displace the input cods
dx/dy displace output
- check Nicolas's follow-up mail
- check libtool version number, should be binary-compat with 7.30
- quadratic doesn't work for order 3

View File

@ -4,7 +4,6 @@ libcolour_la_SOURCES = \
colour.c \
colour.h \
colourspace.c \
colour_dispatch.c \
dE76.c \
dE00.c \
dECMC.c \

View File

@ -45,6 +45,195 @@
#include "colour.h"
/**
* SECTION: colour
* @short_description: colour operators
* @stability: Stable
* @see_also: <link linkend="libvips-arithmetic">arithmetic</link>
* @include: vips/vips.h
*
* These operators let you transform coordinates and images between colour
* spaces, calculate colour differences, and move
* to and from device spaces.
*
* Radiance images have four 8-bits bands and store 8 bits of R, G and B and
* another 8 bits of exponent, common to all channels. They are widely used in
* the HDR imaging community.
*
*
* The colour functions can be divided into three main groups. First,
* functions to transform images between the different colour spaces supported
* by VIPS: <emphasis>RGB</emphasis>, <emphasis>sRGB</emphasis>,
* <emphasis>XYZ</emphasis>, <emphasis>Yxy</emphasis>,
* <emphasis>Lab</emphasis>, <emphasis>LabQ</emphasis>,
* <emphasis>LabS</emphasis>, <emphasis>LCh</emphasis> and
* <emphasis>CMC</emphasis>). Use vips_colourspace() to move an image to a
* target colourspace using the best sequence of colour transform operations.
* Secondly, there are a set of operations for
* calculating colour difference metrics. Finally, VIPS wraps LittleCMS and
* uses it to provide a set of operations for reading and writing images with
* ICC profiles.
*
* This figure shows how the VIPS colour spaces interconvert:
*
* <inlinegraphic fileref="interconvert.png" format="PNG" />
*
* The colour spaces supported by VIPS are:
*
* <itemizedlist>
* <listitem>
* <para>
* <emphasis><code>LabQ</code></emphasis>
*
* This is the principal VIPS colorimetric storage format.
* LabQ images have four 8-bit bands and store 10 bits of L and 11 bits
* of a and b.
*
* You cannot perform calculations on <code>LabQ</code> images (they are
* tagged with %VIPS_CODING_LABQ), though a few operations such as
* vips_extract_area() will work directly with them.
* </para>
* </listitem>
* <listitem>
* <para>
* <emphasis><code>LabS</code></emphasis>
*
* This format represents coordinates in CIELAB space as a
* three-band #VIPS_FORMAT_SHORT image, scaled to fit the full range of
* bits. It is the best format for computation, being relatively
* compact, quick, and accurate. Colour values expressed in this way
* are hard to visualise.
* </para>
* </listitem>
* <listitem>
* <para>
* <emphasis><code>Lab</code></emphasis>
*
* Lab colourspace represents CIELAB colour values with a three-band
* #VIPS_FORMAT_FLOAT image. This is the simplest format for general
* work: adding the constant 50 to the L channel, for example, has the
* expected result.
*
* VIPS uses D65 LAB, but you can use other colour temperatures with a
* little effort, see vips_XYZ2Lab().
* </para>
* </listitem>
* <listitem>
* <para>
* <emphasis><code>XYZ</code></emphasis>
*
* CIE XYZ colour space represented as a three-band #VIPS_FORMAT_FLOAT
* image.
* </para>
* </listitem>
* <listitem>
* <para>
* <emphasis><code>Yxy</code></emphasis>
*
* CIE Yxy colour space represented as a three-band #VIPS_FORMAT_FLOAT
* image.
* </para>
* </listitem>
* <listitem>
* <para>
* <emphasis><code>RGB</code> / <code>sRGB</code></emphasis>
*
* VIPS converts XYZ to and from sRGB using the usual formula:
*
* http://en.wikipedia.org/wiki/SRGB
*
* You can also use vips_icc_transform() and friends to go to and from
* device space with a generic profile.
* </para>
* </listitem>
* <listitem>
* <para>
* <emphasis><code>LCh</code></emphasis>
*
* Like <code>Lab</code>, but rectangular <code>ab</code> coordinates
* are replaced with
* polar <code>Ch</code> (Chroma and hue) coordinates.
* Hue angles are expressed in degrees.
* </para>
* </listitem>
* <listitem>
* <para>
* <emphasis><code>CMC</code></emphasis>
*
* A colour space based on the CMC(1:1) colour difference measurement.
* This is a highly uniform colour space, much better than CIELAB for
* expressing small differences.
*
* You can calculate metrics like CMC(2:1) by scaling the spaces before
* finding differences.
* </para>
* </listitem>
* </itemizedlist>
*/
/* Areas under curves for Dxx. 2 degree observer.
*/
/**
* VIPS_D93_X0:
*
* Areas under curves for D93, 2 degree observer.
*/
/**
* VIPS_D75_X0:
*
* Areas under curves for D75, 2 degree observer.
*/
/**
* VIPS_D65_X0:
*
* Areas under curves for D65, 2 degree observer.
*/
/**
* VIPS_D55_X0:
*
* Areas under curves for D55, 2 degree observer.
*/
/**
* VIPS_D50_X0:
*
* Areas under curves for D50, 2 degree observer.
*/
/**
* VIPS_A_X0:
*
* Areas under curves for illuminant A (2856K), 2 degree observer.
*/
/**
* VIPS_B_X0:
*
* Areas under curves for illuminant B (4874K), 2 degree observer.
*/
/**
* VIPS_C_X0:
*
* Areas under curves for illuminant C (6774K), 2 degree observer.
*/
/**
* VIPS_E_X0:
*
* Areas under curves for equal energy illuminant E.
*/
/**
* VIPS_D3250_X0:
*
* Areas under curves for black body at 3250K, 2 degree observer.
*/
G_DEFINE_ABSTRACT_TYPE( VipsColour, vips_colour, VIPS_TYPE_OPERATION );
/* Maximum number of input images -- why not?

View File

@ -4,6 +4,7 @@ libdeprecated_la_SOURCES = \
im_openslide2vips.c \
im_lab_morph.c \
deprecated_dispatch.c \
colour_dispatch.c \
wrapvips7.c \
lazy.c \
im_dif_std.c \

View File

@ -38,192 +38,6 @@
#include <vips/vips.h>
/**
* SECTION: colour
* @short_description: colour operators
* @stability: Stable
* @see_also: <link linkend="libvips-arithmetic">arithmetic</link>
* @include: vips/vips.h
*
* These operators let you transform coordinates and images between colour
* spaces, calculate colour differences, and move
* to and from device spaces.
*
* Radiance images have four 8-bits bands and store 8 bits of R, G and B and
* another 8 bits of exponent, common to all channels. They are widely used in
* the HDR imaging community.
*
*
* The colour functions can be divided into three main groups. First,
* functions to transform images between the different colour spaces supported
* by VIPS: <emphasis>RGB</emphasis> (also referred to as
* <emphasis>disp</emphasis>), <emphasis>sRGB</emphasis>,
* <emphasis>XYZ</emphasis>, <emphasis>Yxy</emphasis>,
* <emphasis>Lab</emphasis>, <emphasis>LabQ</emphasis>,
* <emphasis>LabS</emphasis>, <emphasis>LCh</emphasis> and
* <emphasis>CMC</emphasis>). Secondly, there are a set of operations for
* calculating colour difference metrics. Finally, VIPS wraps LittleCMS and
* uses it to provide a set of operations for reading and writing images with
* ICC profiles.
*
* This figure shows how the VIPS colour spaces interconvert:
*
* <inlinegraphic fileref="interconvert.png" format="PNG" />
*
* The colour spaces supported by VIPS are:
*
* <itemizedlist>
* <listitem>
* <para>
* <emphasis><code>LabQ</code></emphasis>
*
* This is the principal VIPS colorimetric storage format.
* LabQ images have four 8-bit bands and store 10 bits of L and 11 bits
* of a and b.
*
* You cannot perform calculations on <code>LabQ</code> images (they are
* tagged with %IM_CODING_LABQ), though a few operations such as
* im_extract_area() will work directly with them.
* </para>
* </listitem>
* <listitem>
* <para>
* <emphasis><code>LabS</code></emphasis>
*
* This format represents coordinates in CIELAB space as a
* three-band #IM_BANDFMT_SHORT image, scaled to fit the full range of
* bits. It is the best format for computation, being relatively
* compact, quick, and accurate. Colour values expressed in this way
* are hard to visualise.
* </para>
* </listitem>
* <listitem>
* <para>
* <emphasis><code>Lab</code></emphasis>
*
* Lab colourspace represents CIELAB colour values with a three-band
* #IM_BANDFMT_FLOAT image. This is the simplest format for general
* work: adding the constant 50 to the L channel, for example, has the
* expected result.
*
* VIPS uses D65 LAB, but you can use other colour temperatures with a
* little effort, see im_XYZ2Lab_temp().
* </para>
* </listitem>
* <listitem>
* <para>
* <emphasis><code>XYZ</code></emphasis>
*
* CIE XYZ colour space represented as a three-band %IM_BANDFMT_FLOAT
* image.
* </para>
* </listitem>
* <listitem>
* <para>
* <emphasis><code>Yxy</code></emphasis>
*
* CIE Yxy colour space represented as a three-band %IM_BANDFMT_FLOAT
* image.
* </para>
* </listitem>
* <listitem>
* <para>
* <emphasis><code>RGB</code></emphasis>
*
* (also refered to as <code>disp</code>+) This is a generic 8-bit RGB
* image. VIPS has a system for going to and from RGB with a simple
* display structure, but it's mostly deprecated. See
* <link linkend="libvips-disp">disp</link>.
*
* Use im_icc_export() and friends as a modern replacement.
* </para>
* </listitem>
* <listitem>
* <para>
* <emphasis><code>LCh</code></emphasis>
*
* Like <code>Lab</code>, but rectangular <code>ab</code> coordinates
* are replaced with
* polar <code>Ch</code> (Chroma and hue) coordinates.
* Hue angles are expressed in degrees.
* </para>
* </listitem>
* <listitem>
* <para>
* <emphasis><code>CMC</code></emphasis>
*
* A colour space based on the CMC(1:1) colour difference measurement.
* This is a highly uniform colour space, much better than CIELAB for
* expressing small differences. Conversions to and from
* <code>CMC</code> are extremely slow.
* </para>
* </listitem>
* </itemizedlist>
*/
/* Areas under curves for Dxx. 2 degree observer.
*/
/**
* IM_D93_X0:
*
* Areas under curves for D93, 2 degree observer.
*/
/**
* IM_D75_X0:
*
* Areas under curves for D75, 2 degree observer.
*/
/**
* IM_D65_X0:
*
* Areas under curves for D65, 2 degree observer.
*/
/**
* IM_D55_X0:
*
* Areas under curves for D55, 2 degree observer.
*/
/**
* IM_D50_X0:
*
* Areas under curves for D50, 2 degree observer.
*/
/**
* IM_A_X0:
*
* Areas under curves for illuminant A (2856K), 2 degree observer.
*/
/**
* IM_B_X0:
*
* Areas under curves for illuminant B (4874K), 2 degree observer.
*/
/**
* IM_C_X0:
*
* Areas under curves for illuminant C (6774K), 2 degree observer.
*/
/**
* IM_E_X0:
*
* Areas under curves for equal energy illuminant E.
*/
/**
* IM_D3250_X0:
*
* Areas under curves for black body at 3250K, 2 degree observer.
*/
/* One image in, one out.
*/
static im_arg_desc one_in_one_out[] = {

View File

@ -333,10 +333,8 @@ vips_interpolate_nearest_interpolate( VipsInterpolate *interpolate,
{
const int ps = IM_IMAGE_SIZEOF_PEL( in->im );
/* We know x/y are always positive, so we can just (int) them.
*/
const int xi = (int) (x + 0.5);
const int yi = (int) (y + 0.5);
const int xi = (int) x;
const int yi = (int) y;
const VipsPel *p = IM_REGION_ADDR( in, xi, yi );
VipsPel *q = (VipsPel *) out;