add scRGB functions
This commit is contained in:
parent
1bddb78f6a
commit
c341f0d134
@ -31,6 +31,7 @@
|
|||||||
- add binary complex operations, with cross_phase as the only one so far
|
- add binary complex operations, with cross_phase as the only one so far
|
||||||
- added vips_bandbool(), with vips_bandand(), _bandor(), _bandeor() as
|
- added vips_bandbool(), with vips_bandand(), _bandor(), _bandeor() as
|
||||||
convenience functions
|
convenience functions
|
||||||
|
- added scRGB colourspace, linear light float space with sRGB primaries
|
||||||
|
|
||||||
14/11/12 started 7.30.6
|
14/11/12 started 7.30.6
|
||||||
- capture tiff warnings earlier
|
- capture tiff warnings earlier
|
||||||
|
7
TODO
7
TODO
@ -1,3 +1,10 @@
|
|||||||
|
- get rid of RGB, RGB16, just have sRGB and scRGB? maybe get rid of GREY16
|
||||||
|
too?
|
||||||
|
|
||||||
|
- get rid of sRGB2XYZ? is using two ops much slower?
|
||||||
|
|
||||||
|
- add colourconvert paths for scRGB
|
||||||
|
|
||||||
- now we've removed round-to-nearest from NN, we need something extra in the
|
- now we've removed round-to-nearest from NN, we need something extra in the
|
||||||
affine transform to displace the input cods
|
affine transform to displace the input cods
|
||||||
|
|
||||||
|
@ -98,6 +98,29 @@ static VipsPel vips_red[64 * 64 * 64];
|
|||||||
static VipsPel vips_green[64 * 64 * 64];
|
static VipsPel vips_green[64 * 64 * 64];
|
||||||
static VipsPel vips_blue[64 * 64 * 64];
|
static VipsPel vips_blue[64 * 64 * 64];
|
||||||
|
|
||||||
|
/* sRGB to scRGB.
|
||||||
|
*
|
||||||
|
* @range is eg. 256 for 8-bit data.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
vips_col_sRGB2scRGB( int range, float *lut,
|
||||||
|
int r, int g, int b, float *R, float *G, float *B )
|
||||||
|
{
|
||||||
|
int maxval = range - 1;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = VIPS_CLIP( 0, r, maxval );
|
||||||
|
*R = lut[i];
|
||||||
|
|
||||||
|
i = VIPS_CLIP( 0, g, maxval );
|
||||||
|
*G = lut[i];
|
||||||
|
|
||||||
|
i = VIPS_CLIP( 0, b, maxval );
|
||||||
|
*B = lut[i];
|
||||||
|
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
/* Create the sRGB linear and unlinear luts. @range is eg. 256 for 8-bit luts.
|
/* Create the sRGB linear and unlinear luts. @range is eg. 256 for 8-bit luts.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
@ -156,58 +179,12 @@ vips_col_make_tables_RGB_8( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* sRGB to scRGB.
|
|
||||||
*
|
|
||||||
* @range is eg. 256 for 8-bit data.
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
vips_col_sRGB2scRGB( int range, float *lut,
|
|
||||||
int r, int g, int b, float *R, float *G, float *B )
|
|
||||||
{
|
|
||||||
int maxval = range - 1;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
i = VIPS_CLIP( 0, r, maxval );
|
|
||||||
*R = lut[i];
|
|
||||||
|
|
||||||
i = VIPS_CLIP( 0, g, maxval );
|
|
||||||
*G = lut[i];
|
|
||||||
|
|
||||||
i = VIPS_CLIP( 0, b, maxval );
|
|
||||||
*B = lut[i];
|
|
||||||
|
|
||||||
return( 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We need Y in 0 - 100. We can save three muls later if we pre-scale the
|
|
||||||
* matrix.
|
|
||||||
*
|
|
||||||
* The matrix already includes the D65 channel weighting, so we just scale by
|
|
||||||
* Y.
|
|
||||||
*/
|
|
||||||
#define SCALE (VIPS_D65_Y0)
|
|
||||||
|
|
||||||
/* scRGB to XYZ.
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
vips_col_scRGB2XYZ( float R, float G, float B, float *X, float *Y, float *Z )
|
|
||||||
{
|
|
||||||
*X = SCALE * 0.4124 * R + SCALE * 0.3576 * G + SCALE * 0.18056 * B;
|
|
||||||
*Y = SCALE * 0.2126 * R + SCALE * 0.7152 * G + SCALE * 0.07220 * B;
|
|
||||||
*Z = SCALE * 0.0193 * R + SCALE * 0.1192 * G + SCALE * 0.9505 * B;
|
|
||||||
|
|
||||||
return( 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
vips_col_sRGB2XYZ_8( int r, int g, int b, float *X, float *Y, float *Z )
|
vips_col_sRGB2scRGB_8( int r, int g, int b, float *R, float *G, float *B )
|
||||||
{
|
{
|
||||||
float R, G, B;
|
|
||||||
|
|
||||||
vips_col_make_tables_RGB_8();
|
vips_col_make_tables_RGB_8();
|
||||||
|
|
||||||
return( vips_col_sRGB2scRGB( 256, vips_v2Y_8, r, g, b, &R, &G, &B ) ||
|
return( vips_col_sRGB2scRGB( 256, vips_v2Y_8, r, g, b, R, G, B ) );
|
||||||
vips_col_scRGB2XYZ( R, G, B, X, Y, Z ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
@ -235,20 +212,33 @@ vips_col_make_tables_RGB_16( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
vips_col_sRGB2XYZ_16( int r, int g, int b, float *X, float *Y, float *Z )
|
vips_col_sRGB2scRGB_16( int r, int g, int b, float *R, float *G, float *B )
|
||||||
{
|
{
|
||||||
float R, G, B;
|
|
||||||
|
|
||||||
vips_col_make_tables_RGB_16();
|
vips_col_make_tables_RGB_16();
|
||||||
|
|
||||||
return( vips_col_sRGB2scRGB( 65536, vips_v2Y_16,
|
return( vips_col_sRGB2scRGB( 65536, vips_v2Y_16, r, g, b, R, G, B ) );
|
||||||
r, g, b, &R, &G, &B ) ||
|
}
|
||||||
vips_col_scRGB2XYZ( R, G, B, X, Y, Z ) );
|
|
||||||
|
/* The matrix already includes the D65 channel weighting, so we just scale by
|
||||||
|
* Y.
|
||||||
|
*/
|
||||||
|
#define SCALE (VIPS_D65_Y0)
|
||||||
|
|
||||||
|
/* scRGB to XYZ.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
vips_col_scRGB2XYZ( float R, float G, float B, float *X, float *Y, float *Z )
|
||||||
|
{
|
||||||
|
*X = SCALE * 0.4124 * R + SCALE * 0.3576 * G + SCALE * 0.18056 * B;
|
||||||
|
*Y = SCALE * 0.2126 * R + SCALE * 0.7152 * G + SCALE * 0.07220 * B;
|
||||||
|
*Z = SCALE * 0.0193 * R + SCALE * 0.1192 * G + SCALE * 0.9505 * B;
|
||||||
|
|
||||||
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Turn XYZ into scRGB.
|
/* Turn XYZ into scRGB.
|
||||||
*/
|
*/
|
||||||
static int
|
int
|
||||||
vips_col_XYZ2scRGB( float X, float Y, float Z, float *R, float *G, float *B )
|
vips_col_XYZ2scRGB( float X, float Y, float Z, float *R, float *G, float *B )
|
||||||
{
|
{
|
||||||
*R = 3.2406 / SCALE * X + -1.5372 / SCALE * Y + -0.4986 / SCALE * Z;
|
*R = 3.2406 / SCALE * X + -1.5372 / SCALE * Y + -0.4986 / SCALE * Z;
|
||||||
@ -335,31 +325,24 @@ vips_col_scRGB2sRGB( int range, int *lut,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
vips_col_XYZ2sRGB_8( float X, float Y, float Z,
|
vips_col_scRGB2sRGB_8( float R, float G, float B,
|
||||||
int *r, int *g, int *b,
|
int *r, int *g, int *b,
|
||||||
int *or )
|
int *or )
|
||||||
{
|
{
|
||||||
float R, G, B;
|
|
||||||
|
|
||||||
vips_col_make_tables_RGB_8();
|
vips_col_make_tables_RGB_8();
|
||||||
|
|
||||||
return( vips_col_XYZ2scRGB( X, Y, Z, &R, &G, &B ) ||
|
return( vips_col_scRGB2sRGB( 256, vips_Y2v_8, R, G, B, r, g, b, or ) );
|
||||||
vips_col_scRGB2sRGB( 256, vips_Y2v_8,
|
|
||||||
R, G, B, r, g, b, or ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
vips_col_XYZ2sRGB_16( float X, float Y, float Z,
|
vips_col_scRGB2sRGB_16( float R, float G, float B,
|
||||||
int *r, int *g, int *b,
|
int *r, int *g, int *b,
|
||||||
int *or )
|
int *or )
|
||||||
{
|
{
|
||||||
float R, G, B;
|
|
||||||
|
|
||||||
vips_col_make_tables_RGB_16();
|
vips_col_make_tables_RGB_16();
|
||||||
|
|
||||||
return( vips_col_XYZ2scRGB( X, Y, Z, &R, &G, &B ) ||
|
return( vips_col_scRGB2sRGB( 65536, vips_Y2v_16,
|
||||||
vips_col_scRGB2sRGB( 65536, vips_Y2v_16,
|
R, G, B, r, g, b, or ) );
|
||||||
R, G, B, r, g, b, or ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build Lab->disp dither tables.
|
/* Build Lab->disp dither tables.
|
||||||
@ -379,11 +362,13 @@ build_tables( void *client )
|
|||||||
float A = (signed char) (a << 2);
|
float A = (signed char) (a << 2);
|
||||||
float B = (signed char) (b << 2);
|
float B = (signed char) (b << 2);
|
||||||
float X, Y, Z;
|
float X, Y, Z;
|
||||||
|
float Rf, Gf, Bf;
|
||||||
int rb, gb, bb;
|
int rb, gb, bb;
|
||||||
int oflow;
|
int oflow;
|
||||||
|
|
||||||
vips_col_Lab2XYZ( L, A, B, &X, &Y, &Z );
|
vips_col_Lab2XYZ( L, A, B, &X, &Y, &Z );
|
||||||
vips_col_XYZ2sRGB_8( X, Y, Z,
|
vips_col_XYZ2scRGB( X, Y, Z, &Rf, &Gf, &Bf );
|
||||||
|
vips_col_scRGB2sRGB_8( Rf, Gf, Bf,
|
||||||
&rb, &gb, &bb, &oflow );
|
&rb, &gb, &bb, &oflow );
|
||||||
|
|
||||||
t = INDEX( l, a, b );
|
t = INDEX( l, a, b );
|
||||||
|
@ -26,6 +26,10 @@ libcolour_la_SOURCES = \
|
|||||||
LabQ2LabS.c \
|
LabQ2LabS.c \
|
||||||
LabQ2sRGB.c \
|
LabQ2sRGB.c \
|
||||||
XYZ2sRGB.c \
|
XYZ2sRGB.c \
|
||||||
sRGB2XYZ.c
|
sRGB2XYZ.c \
|
||||||
|
sRGB2scRGB.c \
|
||||||
|
scRGB2XYZ.c \
|
||||||
|
XYZ2scRGB.c \
|
||||||
|
scRGB2sRGB.c
|
||||||
|
|
||||||
INCLUDES = -I${top_srcdir}/libvips/include @VIPS_CFLAGS@ @VIPS_INCLUDES@
|
INCLUDES = -I${top_srcdir}/libvips/include @VIPS_CFLAGS@ @VIPS_INCLUDES@
|
||||||
|
@ -85,10 +85,12 @@ vips_XYZ2sRGB_line_8( VipsPel *q, float *p, int width )
|
|||||||
float Y = p[1];
|
float Y = p[1];
|
||||||
float Z = p[2];
|
float Z = p[2];
|
||||||
|
|
||||||
|
float R, G, B;
|
||||||
int r, g, b;
|
int r, g, b;
|
||||||
int or;
|
int or;
|
||||||
|
|
||||||
vips_col_XYZ2sRGB_8( X, Y, Z, &r, &g, &b, &or );
|
vips_col_XYZ2scRGB( X, Y, Z, &R, &G, &B );
|
||||||
|
vips_col_scRGB2sRGB_8( R, G, B, &r, &g, &b, &or );
|
||||||
|
|
||||||
p += 3;
|
p += 3;
|
||||||
|
|
||||||
@ -110,10 +112,12 @@ vips_XYZ2sRGB_line_16( unsigned short *q, float *p, int width )
|
|||||||
float Y = p[1];
|
float Y = p[1];
|
||||||
float Z = p[2];
|
float Z = p[2];
|
||||||
|
|
||||||
|
float R, G, B;
|
||||||
int r, g, b;
|
int r, g, b;
|
||||||
int or;
|
int or;
|
||||||
|
|
||||||
vips_col_XYZ2sRGB_16( X, Y, Z, &r, &g, &b, &or );
|
vips_col_XYZ2scRGB( X, Y, Z, &R, &G, &B );
|
||||||
|
vips_col_scRGB2sRGB_16( R, G, B, &r, &g, &b, &or );
|
||||||
|
|
||||||
p += 3;
|
p += 3;
|
||||||
|
|
||||||
|
118
libvips/colour/XYZ2scRGB.c
Normal file
118
libvips/colour/XYZ2scRGB.c
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
/* Turn XYZ to scRGB colourspace.
|
||||||
|
*
|
||||||
|
* 11/12/12
|
||||||
|
* - from Yxy2XYZ.c
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
This file is part of VIPS.
|
||||||
|
|
||||||
|
VIPS is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 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 Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif /*HAVE_CONFIG_H*/
|
||||||
|
#include <vips/intl.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include <vips/vips.h>
|
||||||
|
|
||||||
|
#include "colour.h"
|
||||||
|
|
||||||
|
typedef VipsColourSpace VipsXYZ2scRGB;
|
||||||
|
typedef VipsColourSpaceClass VipsXYZ2scRGBClass;
|
||||||
|
|
||||||
|
G_DEFINE_TYPE( VipsXYZ2scRGB, vips_XYZ2scRGB, VIPS_TYPE_COLOUR_SPACE );
|
||||||
|
|
||||||
|
void
|
||||||
|
vips_XYZ2scRGB_line( VipsColour *colour, VipsPel *out, VipsPel **in, int width )
|
||||||
|
{
|
||||||
|
float *p = (float *) in[0];
|
||||||
|
float *q = (float *) out;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for( i = 0; i < width; i++ ) {
|
||||||
|
float X = p[0];
|
||||||
|
float Y = p[1];
|
||||||
|
float Z = p[2];
|
||||||
|
|
||||||
|
float R, G, B;
|
||||||
|
|
||||||
|
p += 3;
|
||||||
|
|
||||||
|
vips_col_XYZ2scRGB( X, Y, Z, &R, &G, &B );
|
||||||
|
|
||||||
|
q[0] = R;
|
||||||
|
q[1] = G;
|
||||||
|
q[2] = B;
|
||||||
|
|
||||||
|
q += 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
vips_XYZ2scRGB_class_init( VipsXYZ2scRGBClass *class )
|
||||||
|
{
|
||||||
|
VipsObjectClass *object_class = (VipsObjectClass *) class;
|
||||||
|
VipsColourClass *colour_class = VIPS_COLOUR_CLASS( class );
|
||||||
|
|
||||||
|
object_class->nickname = "XYZ2scRGB";
|
||||||
|
object_class->description = _( "transform XYZ to scRGB" );
|
||||||
|
|
||||||
|
colour_class->process_line = vips_XYZ2scRGB_line;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
vips_XYZ2scRGB_init( VipsXYZ2scRGB *XYZ2scRGB )
|
||||||
|
{
|
||||||
|
VipsColour *colour = VIPS_COLOUR( XYZ2scRGB );
|
||||||
|
|
||||||
|
colour->interpretation = VIPS_INTERPRETATION_scRGB;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* vips_XYZ2scRGB:
|
||||||
|
* @in: input image
|
||||||
|
* @out: output image
|
||||||
|
*
|
||||||
|
* Turn XYZ to Yxy.
|
||||||
|
*
|
||||||
|
* Returns: 0 on success, -1 on error
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
vips_XYZ2scRGB( VipsImage *in, VipsImage **out, ... )
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
va_start( ap, out );
|
||||||
|
result = vips_call_split( "XYZ2scRGB", ap, in, out );
|
||||||
|
va_end( ap );
|
||||||
|
|
||||||
|
return( result );
|
||||||
|
}
|
||||||
|
|
@ -798,6 +798,10 @@ vips_colour_operation_init( void )
|
|||||||
extern GType vips_LabQ2sRGB_get_type( void );
|
extern GType vips_LabQ2sRGB_get_type( void );
|
||||||
extern GType vips_XYZ2sRGB_get_type( void );
|
extern GType vips_XYZ2sRGB_get_type( void );
|
||||||
extern GType vips_sRGB2XYZ_get_type( void );
|
extern GType vips_sRGB2XYZ_get_type( void );
|
||||||
|
extern GType vips_sRGB2scRGB_get_type( void );
|
||||||
|
extern GType vips_scRGB2XYZ_get_type( void );
|
||||||
|
extern GType vips_XYZ2scRGB_get_type( void );
|
||||||
|
extern GType vips_scRGB2sRGB_get_type( void );
|
||||||
#if defined(HAVE_LCMS) || defined(HAVE_LCMS2)
|
#if defined(HAVE_LCMS) || defined(HAVE_LCMS2)
|
||||||
extern GType vips_icc_import_get_type( void );
|
extern GType vips_icc_import_get_type( void );
|
||||||
extern GType vips_icc_export_get_type( void );
|
extern GType vips_icc_export_get_type( void );
|
||||||
@ -827,6 +831,10 @@ vips_colour_operation_init( void )
|
|||||||
vips_LabQ2sRGB_get_type();
|
vips_LabQ2sRGB_get_type();
|
||||||
vips_XYZ2sRGB_get_type();
|
vips_XYZ2sRGB_get_type();
|
||||||
vips_sRGB2XYZ_get_type();
|
vips_sRGB2XYZ_get_type();
|
||||||
|
vips_sRGB2scRGB_get_type();
|
||||||
|
vips_scRGB2XYZ_get_type();
|
||||||
|
vips_XYZ2scRGB_get_type();
|
||||||
|
vips_scRGB2sRGB_get_type();
|
||||||
#if defined(HAVE_LCMS) || defined(HAVE_LCMS2)
|
#if defined(HAVE_LCMS) || defined(HAVE_LCMS2)
|
||||||
vips_icc_import_get_type();
|
vips_icc_import_get_type();
|
||||||
vips_icc_export_get_type();
|
vips_icc_export_get_type();
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* - redone as a class
|
* - redone as a class
|
||||||
* - sRGB only, support for other RGBs is now via lcms
|
* - sRGB only, support for other RGBs is now via lcms
|
||||||
* 6/11/12
|
* 6/11/12
|
||||||
* - add 15-bit sRGB import
|
* - add 16-bit sRGB import
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -67,11 +67,14 @@ vips_sRGB2XYZ_line_8( float *q, VipsPel *p, int width )
|
|||||||
int r = p[0];
|
int r = p[0];
|
||||||
int g = p[1];
|
int g = p[1];
|
||||||
int b = p[2];
|
int b = p[2];
|
||||||
|
|
||||||
|
float R, G, B;
|
||||||
float X, Y, Z;
|
float X, Y, Z;
|
||||||
|
|
||||||
p += 3;
|
p += 3;
|
||||||
|
|
||||||
vips_col_sRGB2XYZ_8( r, g, b, &X, &Y, &Z );
|
vips_col_sRGB2scRGB_8( r, g, b, &R, &G, &B );
|
||||||
|
vips_col_scRGB2XYZ( R, G, B, &X, &Y, &Z );
|
||||||
|
|
||||||
q[0] = X;
|
q[0] = X;
|
||||||
q[1] = Y;
|
q[1] = Y;
|
||||||
@ -92,11 +95,14 @@ vips_sRGB2XYZ_line_16( float *q, unsigned short *p, int width )
|
|||||||
int r = p[0];
|
int r = p[0];
|
||||||
int g = p[1];
|
int g = p[1];
|
||||||
int b = p[2];
|
int b = p[2];
|
||||||
|
|
||||||
|
float R, G, B;
|
||||||
float X, Y, Z;
|
float X, Y, Z;
|
||||||
|
|
||||||
p += 3;
|
p += 3;
|
||||||
|
|
||||||
vips_col_sRGB2XYZ_16( r, g, b, &X, &Y, &Z );
|
vips_col_sRGB2scRGB_16( r, g, b, &R, &G, &B );
|
||||||
|
vips_col_scRGB2XYZ( R, G, B, &X, &Y, &Z );
|
||||||
|
|
||||||
q[0] = X;
|
q[0] = X;
|
||||||
q[1] = Y;
|
q[1] = Y;
|
||||||
|
186
libvips/colour/sRGB2scRGB.c
Normal file
186
libvips/colour/sRGB2scRGB.c
Normal file
@ -0,0 +1,186 @@
|
|||||||
|
/* Turn displayable rgb files to scRGB.
|
||||||
|
*
|
||||||
|
* 11/12/12
|
||||||
|
* - from sRGB2XYZ.c
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
This file is part of VIPS.
|
||||||
|
|
||||||
|
VIPS is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 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 Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif /*HAVE_CONFIG_H*/
|
||||||
|
#include <vips/intl.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include <vips/vips.h>
|
||||||
|
|
||||||
|
#include "colour.h"
|
||||||
|
|
||||||
|
typedef VipsColourCode VipssRGB2scRGB;
|
||||||
|
typedef VipsColourCodeClass VipssRGB2scRGBClass;
|
||||||
|
|
||||||
|
G_DEFINE_TYPE( VipssRGB2scRGB, vips_sRGB2scRGB, VIPS_TYPE_COLOUR_CODE );
|
||||||
|
|
||||||
|
/* Convert a buffer of 8-bit pixels.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
vips_sRGB2scRGB_line_8( float *q, VipsPel *p, int width )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for( i = 0; i < width; i++ ) {
|
||||||
|
int r = p[0];
|
||||||
|
int g = p[1];
|
||||||
|
int b = p[2];
|
||||||
|
|
||||||
|
float R, G, B;
|
||||||
|
|
||||||
|
p += 3;
|
||||||
|
|
||||||
|
vips_col_sRGB2scRGB_8( r, g, b, &R, &G, &B );
|
||||||
|
|
||||||
|
q[0] = R;
|
||||||
|
q[1] = G;
|
||||||
|
q[2] = B;
|
||||||
|
|
||||||
|
q += 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Convert a buffer of 16-bit pixels.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
vips_sRGB2scRGB_line_16( float *q, unsigned short *p, int width )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for( i = 0; i < width; i++ ) {
|
||||||
|
int r = p[0];
|
||||||
|
int g = p[1];
|
||||||
|
int b = p[2];
|
||||||
|
|
||||||
|
float R, G, B;
|
||||||
|
|
||||||
|
p += 3;
|
||||||
|
|
||||||
|
vips_col_sRGB2scRGB_16( r, g, b, &R, &G, &B );
|
||||||
|
|
||||||
|
q[0] = R;
|
||||||
|
q[1] = G;
|
||||||
|
q[2] = B;
|
||||||
|
|
||||||
|
q += 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
vips_sRGB2scRGB_line( VipsColour *colour,
|
||||||
|
VipsPel *out, VipsPel **in, int width )
|
||||||
|
{
|
||||||
|
if( colour->in[0]->BandFmt == VIPS_FORMAT_UCHAR )
|
||||||
|
vips_sRGB2scRGB_line_8( (float *) out,
|
||||||
|
(VipsPel *) in[0], width );
|
||||||
|
else
|
||||||
|
vips_sRGB2scRGB_line_16( (float *) out,
|
||||||
|
(unsigned short *) in[0], width );
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
vips_sRGB2scRGB_build( VipsObject *object )
|
||||||
|
{
|
||||||
|
VipsColourCode *code = (VipsColourCode *) object;
|
||||||
|
|
||||||
|
if( code->in )
|
||||||
|
code->input_format =
|
||||||
|
code->in->BandFmt == VIPS_FORMAT_USHORT ?
|
||||||
|
VIPS_FORMAT_USHORT : VIPS_FORMAT_UCHAR;
|
||||||
|
|
||||||
|
if( VIPS_OBJECT_CLASS( vips_sRGB2scRGB_parent_class )->
|
||||||
|
build( object ) )
|
||||||
|
return( -1 );
|
||||||
|
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
vips_sRGB2scRGB_class_init( VipssRGB2scRGBClass *class )
|
||||||
|
{
|
||||||
|
VipsObjectClass *object_class = (VipsObjectClass *) class;
|
||||||
|
VipsColourClass *colour_class = VIPS_COLOUR_CLASS( class );
|
||||||
|
|
||||||
|
object_class->nickname = "sRGB2scRGB";
|
||||||
|
object_class->description = _( "convert an sRGB image to scRGB" );
|
||||||
|
object_class->build = vips_sRGB2scRGB_build;
|
||||||
|
|
||||||
|
colour_class->process_line = vips_sRGB2scRGB_line;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
vips_sRGB2scRGB_init( VipssRGB2scRGB *sRGB2scRGB )
|
||||||
|
{
|
||||||
|
VipsColour *colour = VIPS_COLOUR( sRGB2scRGB );
|
||||||
|
VipsColourCode *code = VIPS_COLOUR_CODE( sRGB2scRGB );
|
||||||
|
|
||||||
|
colour->coding = VIPS_CODING_NONE;
|
||||||
|
colour->interpretation = VIPS_INTERPRETATION_scRGB;
|
||||||
|
colour->format = VIPS_FORMAT_FLOAT;
|
||||||
|
colour->bands = 3;
|
||||||
|
|
||||||
|
code->input_coding = VIPS_CODING_NONE;
|
||||||
|
code->input_bands = 3;
|
||||||
|
|
||||||
|
/* The default. This can get changed above ^^ if we see a
|
||||||
|
* 16-bit input.
|
||||||
|
*/
|
||||||
|
code->input_format = VIPS_FORMAT_UCHAR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* vips_sRGB2scRGB:
|
||||||
|
* @in: input image
|
||||||
|
* @out: output image
|
||||||
|
*
|
||||||
|
* Convert an sRGB image to scRGB.
|
||||||
|
*
|
||||||
|
* See also: vips_sRGB2XYZ(), vips_rad2float().
|
||||||
|
*
|
||||||
|
* Returns: 0 on success, -1 on error.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
vips_sRGB2scRGB( VipsImage *in, VipsImage **out, ... )
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
va_start( ap, out );
|
||||||
|
result = vips_call_split( "sRGB2scRGB", ap, in, out );
|
||||||
|
va_end( ap );
|
||||||
|
|
||||||
|
return( result );
|
||||||
|
}
|
123
libvips/colour/scRGB2XYZ.c
Normal file
123
libvips/colour/scRGB2XYZ.c
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
/* Turn scRGB to XYZ colourspace.
|
||||||
|
*
|
||||||
|
* Modified:
|
||||||
|
* 29/5/02 JC
|
||||||
|
* - from lab2xyz
|
||||||
|
* 2/11/09
|
||||||
|
* - gtkdoc
|
||||||
|
* - cleanups
|
||||||
|
* 20/9/12
|
||||||
|
* redo as a class
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
This file is part of VIPS.
|
||||||
|
|
||||||
|
VIPS is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 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 Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif /*HAVE_CONFIG_H*/
|
||||||
|
#include <vips/intl.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include <vips/vips.h>
|
||||||
|
|
||||||
|
#include "colour.h"
|
||||||
|
|
||||||
|
typedef VipsColourSpace VipsscRGB2XYZ;
|
||||||
|
typedef VipsColourSpaceClass VipsscRGB2XYZClass;
|
||||||
|
|
||||||
|
G_DEFINE_TYPE( VipsscRGB2XYZ, vips_scRGB2XYZ, VIPS_TYPE_COLOUR_SPACE );
|
||||||
|
|
||||||
|
void
|
||||||
|
vips_scRGB2XYZ_line( VipsColour *colour, VipsPel *out, VipsPel **in, int width )
|
||||||
|
{
|
||||||
|
float *p = (float *) in[0];
|
||||||
|
float *q = (float *) out;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for( i = 0; i < width; i++ ) {
|
||||||
|
float R = p[0];
|
||||||
|
float G = p[1];
|
||||||
|
float B = p[2];
|
||||||
|
|
||||||
|
float X, Y, Z;
|
||||||
|
|
||||||
|
p += 3;
|
||||||
|
|
||||||
|
vips_col_scRGB2XYZ( R, G, B, &X, &Y, &Z );
|
||||||
|
|
||||||
|
q[0] = X;
|
||||||
|
q[1] = Y;
|
||||||
|
q[2] = Z;
|
||||||
|
q += 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
vips_scRGB2XYZ_class_init( VipsscRGB2XYZClass *class )
|
||||||
|
{
|
||||||
|
VipsObjectClass *object_class = (VipsObjectClass *) class;
|
||||||
|
VipsColourClass *colour_class = VIPS_COLOUR_CLASS( class );
|
||||||
|
|
||||||
|
object_class->nickname = "scRGB2XYZ";
|
||||||
|
object_class->description = _( "transform scRGB to XYZ" );
|
||||||
|
|
||||||
|
colour_class->process_line = vips_scRGB2XYZ_line;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
vips_scRGB2XYZ_init( VipsscRGB2XYZ *scRGB2XYZ )
|
||||||
|
{
|
||||||
|
VipsColour *colour = VIPS_COLOUR( scRGB2XYZ );
|
||||||
|
|
||||||
|
colour->interpretation = VIPS_INTERPRETATION_XYZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* vips_scRGB2XYZ:
|
||||||
|
* @in: input image
|
||||||
|
* @out: output image
|
||||||
|
*
|
||||||
|
* Turn XYZ to scRGB.
|
||||||
|
*
|
||||||
|
* Returns: 0 on success, -1 on error
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
vips_scRGB2XYZ( VipsImage *in, VipsImage **out, ... )
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
va_start( ap, out );
|
||||||
|
result = vips_call_split( "scRGB2XYZ", ap, in, out );
|
||||||
|
va_end( ap );
|
||||||
|
|
||||||
|
return( result );
|
||||||
|
}
|
||||||
|
|
222
libvips/colour/scRGB2sRGB.c
Normal file
222
libvips/colour/scRGB2sRGB.c
Normal file
@ -0,0 +1,222 @@
|
|||||||
|
/* Turn scRGB files into displayable rgb.
|
||||||
|
*
|
||||||
|
* 11/12/12
|
||||||
|
* - from XYZ2sRGB.c
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
This file is part of VIPS.
|
||||||
|
|
||||||
|
VIPS is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 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 Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif /*HAVE_CONFIG_H*/
|
||||||
|
#include <vips/intl.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include <vips/vips.h>
|
||||||
|
|
||||||
|
#include "colour.h"
|
||||||
|
|
||||||
|
typedef struct _VipsscRGB2sRGB {
|
||||||
|
VipsColourCode parent_instance;
|
||||||
|
|
||||||
|
int depth;
|
||||||
|
} VipsscRGB2sRGB;
|
||||||
|
|
||||||
|
typedef VipsColourCodeClass VipsscRGB2sRGBClass;
|
||||||
|
|
||||||
|
G_DEFINE_TYPE( VipsscRGB2sRGB, vips_scRGB2sRGB, VIPS_TYPE_COLOUR_CODE );
|
||||||
|
|
||||||
|
/* Process a buffer of data.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
vips_scRGB2sRGB_line_8( VipsPel *q, float *p, int width )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for( i = 0; i < width; i++ ) {
|
||||||
|
float R = p[0];
|
||||||
|
float G = p[1];
|
||||||
|
float B = p[2];
|
||||||
|
|
||||||
|
int r, g, b;
|
||||||
|
int or;
|
||||||
|
|
||||||
|
vips_col_scRGB2sRGB_8( R, G, B, &r, &g, &b, &or );
|
||||||
|
|
||||||
|
p += 3;
|
||||||
|
|
||||||
|
q[0] = r;
|
||||||
|
q[1] = g;
|
||||||
|
q[2] = b;
|
||||||
|
|
||||||
|
q += 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
vips_scRGB2sRGB_line_16( unsigned short *q, float *p, int width )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for( i = 0; i < width; i++ ) {
|
||||||
|
float R = p[0];
|
||||||
|
float G = p[1];
|
||||||
|
float B = p[2];
|
||||||
|
|
||||||
|
int r, g, b;
|
||||||
|
int or;
|
||||||
|
|
||||||
|
vips_col_scRGB2sRGB_16( R, G, B, &r, &g, &b, &or );
|
||||||
|
|
||||||
|
p += 3;
|
||||||
|
|
||||||
|
q[0] = r;
|
||||||
|
q[1] = g;
|
||||||
|
q[2] = b;
|
||||||
|
|
||||||
|
q += 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
vips_scRGB2sRGB_line( VipsColour *colour,
|
||||||
|
VipsPel *out, VipsPel **in, int width )
|
||||||
|
{
|
||||||
|
VipsscRGB2sRGB *scRGB2sRGB = (VipsscRGB2sRGB *) colour;
|
||||||
|
|
||||||
|
if( scRGB2sRGB->depth == 16 )
|
||||||
|
vips_scRGB2sRGB_line_16( (unsigned short *) out,
|
||||||
|
(float *) in[0], width );
|
||||||
|
else
|
||||||
|
vips_scRGB2sRGB_line_8( (VipsPel *) out,
|
||||||
|
(float *) in[0], width );
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
vips_scRGB2sRGB_build( VipsObject *object )
|
||||||
|
{
|
||||||
|
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
|
||||||
|
VipsscRGB2sRGB *scRGB2sRGB = (VipsscRGB2sRGB *) object;
|
||||||
|
VipsColour *colour = VIPS_COLOUR( scRGB2sRGB );
|
||||||
|
|
||||||
|
switch( scRGB2sRGB->depth ) {
|
||||||
|
case 16:
|
||||||
|
colour->interpretation = VIPS_INTERPRETATION_RGB16;
|
||||||
|
colour->format = VIPS_FORMAT_USHORT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 8:
|
||||||
|
colour->interpretation = VIPS_INTERPRETATION_sRGB;
|
||||||
|
colour->format = VIPS_FORMAT_UCHAR;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
vips_error( class->nickname,
|
||||||
|
"%s", _( "depth must be 8 or 16" ) );
|
||||||
|
return( -1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( VIPS_OBJECT_CLASS( vips_scRGB2sRGB_parent_class )->build( object ) )
|
||||||
|
return( -1 );
|
||||||
|
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
vips_scRGB2sRGB_class_init( VipsscRGB2sRGBClass *class )
|
||||||
|
{
|
||||||
|
GObjectClass *gobject_class = G_OBJECT_CLASS( class );
|
||||||
|
VipsObjectClass *object_class = (VipsObjectClass *) class;
|
||||||
|
VipsColourClass *colour_class = VIPS_COLOUR_CLASS( class );
|
||||||
|
|
||||||
|
gobject_class->set_property = vips_object_set_property;
|
||||||
|
gobject_class->get_property = vips_object_get_property;
|
||||||
|
|
||||||
|
object_class->nickname = "scRGB2sRGB";
|
||||||
|
object_class->description = _( "convert an scRGB image to sRGB" );
|
||||||
|
object_class->build = vips_scRGB2sRGB_build;
|
||||||
|
|
||||||
|
colour_class->process_line = vips_scRGB2sRGB_line;
|
||||||
|
|
||||||
|
VIPS_ARG_INT( class, "depth", 130,
|
||||||
|
_( "Depth" ),
|
||||||
|
_( "Output device space depth in bits" ),
|
||||||
|
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||||
|
G_STRUCT_OFFSET( VipsscRGB2sRGB, depth ),
|
||||||
|
8, 16, 8 );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
vips_scRGB2sRGB_init( VipsscRGB2sRGB *scRGB2sRGB )
|
||||||
|
{
|
||||||
|
VipsColour *colour = VIPS_COLOUR( scRGB2sRGB );
|
||||||
|
VipsColourCode *code = VIPS_COLOUR_CODE( scRGB2sRGB );
|
||||||
|
|
||||||
|
/* Just the default, can be overridden, see above.
|
||||||
|
*/
|
||||||
|
colour->coding = VIPS_CODING_NONE;
|
||||||
|
colour->interpretation = VIPS_INTERPRETATION_sRGB;
|
||||||
|
colour->format = VIPS_FORMAT_UCHAR;
|
||||||
|
colour->bands = 3;
|
||||||
|
|
||||||
|
code->input_coding = VIPS_CODING_NONE;
|
||||||
|
code->input_bands = 3;
|
||||||
|
code->input_format = VIPS_FORMAT_FLOAT;
|
||||||
|
|
||||||
|
scRGB2sRGB->depth = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* vips_scRGB2sRGB:
|
||||||
|
* @in: input image
|
||||||
|
* @out: output image
|
||||||
|
*
|
||||||
|
* Optional arguments:
|
||||||
|
*
|
||||||
|
* @depth: depth of output image in bits
|
||||||
|
*
|
||||||
|
* Convert an scRGB image to sRGB. Set @depth to 16 to get 16-bit output.
|
||||||
|
*
|
||||||
|
* See also: im_LabS2LabQ(), im_scRGB2sRGB(), im_rad2float().
|
||||||
|
*
|
||||||
|
* Returns: 0 on success, -1 on error.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
vips_scRGB2sRGB( VipsImage *in, VipsImage **out, ... )
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
va_start( ap, out );
|
||||||
|
result = vips_call_split( "scRGB2sRGB", ap, in, out );
|
||||||
|
va_end( ap );
|
||||||
|
|
||||||
|
return( result );
|
||||||
|
}
|
||||||
|
|
@ -141,10 +141,21 @@ int vips_Lab2XYZ( VipsImage *in, VipsImage **out, ... )
|
|||||||
__attribute__((sentinel));
|
__attribute__((sentinel));
|
||||||
int vips_XYZ2Lab( VipsImage *in, VipsImage **out, ... )
|
int vips_XYZ2Lab( VipsImage *in, VipsImage **out, ... )
|
||||||
__attribute__((sentinel));
|
__attribute__((sentinel));
|
||||||
|
|
||||||
|
int vips_XYZ2scRGB( VipsImage *in, VipsImage **out, ... )
|
||||||
|
__attribute__((sentinel));
|
||||||
|
int vips_scRGB2sRGB( VipsImage *in, VipsImage **out, ... )
|
||||||
|
__attribute__((sentinel));
|
||||||
int vips_XYZ2sRGB( VipsImage *in, VipsImage **out, ... )
|
int vips_XYZ2sRGB( VipsImage *in, VipsImage **out, ... )
|
||||||
__attribute__((sentinel));
|
__attribute__((sentinel));
|
||||||
|
|
||||||
int vips_sRGB2XYZ( VipsImage *in, VipsImage **out, ... )
|
int vips_sRGB2XYZ( VipsImage *in, VipsImage **out, ... )
|
||||||
__attribute__((sentinel));
|
__attribute__((sentinel));
|
||||||
|
int vips_sRGB2scRGB( VipsImage *in, VipsImage **out, ... )
|
||||||
|
__attribute__((sentinel));
|
||||||
|
int vips_scRGB2XYZ( VipsImage *in, VipsImage **out, ... )
|
||||||
|
__attribute__((sentinel));
|
||||||
|
|
||||||
int vips_LCh2CMC( VipsImage *in, VipsImage **out, ... )
|
int vips_LCh2CMC( VipsImage *in, VipsImage **out, ... )
|
||||||
__attribute__((sentinel));
|
__attribute__((sentinel));
|
||||||
int vips_CMC2LCh( VipsImage *in, VipsImage **out, ... )
|
int vips_CMC2LCh( VipsImage *in, VipsImage **out, ... )
|
||||||
@ -193,13 +204,20 @@ float vips_col_Lcmc2L( float Lcmc );
|
|||||||
float vips_col_Ccmc2C( float Ccmc );
|
float vips_col_Ccmc2C( float Ccmc );
|
||||||
float vips_col_Chcmc2h( float C, float hcmc );
|
float vips_col_Chcmc2h( float C, float hcmc );
|
||||||
|
|
||||||
int vips_col_XYZ2sRGB_8( float X, float Y, float Z,
|
int vips_col_sRGB2scRGB_8( int r, int g, int b, float *R, float *G, float *B );
|
||||||
int *r, int *g, int *b, int *or_ret );
|
int vips_col_sRGB2scRGB_16( int r, int g, int b, float *R, float *G, float *B );
|
||||||
int vips_col_sRGB2XYZ_8( int r, int g, int b, float *X, float *Y, float *Z );
|
|
||||||
|
|
||||||
int vips_col_XYZ2sRGB_16( float X, float Y, float Z,
|
int vips_col_scRGB2XYZ( float R, float G, float B,
|
||||||
int *r, int *g, int *b, int *or_ret );
|
float *X, float *Y, float *Z );
|
||||||
int vips_col_sRGB2XYZ_16( int r, int g, int b, float *X, float *Y, float *Z );
|
int vips_col_XYZ2scRGB( float X, float Y, float Z,
|
||||||
|
float *R, float *G, float *B );
|
||||||
|
|
||||||
|
int vips_col_scRGB2sRGB_8( float R, float G, float B,
|
||||||
|
int *r, int *g, int *b,
|
||||||
|
int *or_ret );
|
||||||
|
int vips_col_scRGB2sRGB_16( float R, float G, float B,
|
||||||
|
int *r, int *g, int *b,
|
||||||
|
int *or_ret );
|
||||||
|
|
||||||
float vips_pythagoras( float L1, float a1, float b1,
|
float vips_pythagoras( float L1, float a1, float b1,
|
||||||
float L2, float a2, float b2 );
|
float L2, float a2, float b2 );
|
||||||
|
@ -122,6 +122,7 @@ typedef enum {
|
|||||||
* @VIPS_INTERPRETATION_LCH: pixels are in CIE LCh space
|
* @VIPS_INTERPRETATION_LCH: pixels are in CIE LCh space
|
||||||
* @VIPS_INTERPRETATION_LABS: CIE LAB coded as three signed 16-bit values
|
* @VIPS_INTERPRETATION_LABS: CIE LAB coded as three signed 16-bit values
|
||||||
* @VIPS_INTERPRETATION_sRGB: pixels are sRGB
|
* @VIPS_INTERPRETATION_sRGB: pixels are sRGB
|
||||||
|
* @VIPS_INTERPRETATION_scRGB: pixels are scRGB
|
||||||
* @VIPS_INTERPRETATION_YXY: pixels are CIE Yxy
|
* @VIPS_INTERPRETATION_YXY: pixels are CIE Yxy
|
||||||
* @VIPS_INTERPRETATION_RGB16: generic 16-bit RGB
|
* @VIPS_INTERPRETATION_RGB16: generic 16-bit RGB
|
||||||
* @VIPS_INTERPRETATION_GREY16: generic 16-bit mono
|
* @VIPS_INTERPRETATION_GREY16: generic 16-bit mono
|
||||||
@ -156,7 +157,8 @@ typedef enum {
|
|||||||
VIPS_INTERPRETATION_FOURIER = 24,
|
VIPS_INTERPRETATION_FOURIER = 24,
|
||||||
VIPS_INTERPRETATION_RGB16 = 25,
|
VIPS_INTERPRETATION_RGB16 = 25,
|
||||||
VIPS_INTERPRETATION_GREY16 = 26,
|
VIPS_INTERPRETATION_GREY16 = 26,
|
||||||
VIPS_INTERPRETATION_ARRAY = 27
|
VIPS_INTERPRETATION_ARRAY = 27,
|
||||||
|
VIPS_INTERPRETATION_scRGB = 28
|
||||||
} VipsInterpretation;
|
} VipsInterpretation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -493,6 +493,7 @@ vips_interpretation_get_type( void )
|
|||||||
{VIPS_INTERPRETATION_RGB16, "VIPS_INTERPRETATION_RGB16", "rgb16"},
|
{VIPS_INTERPRETATION_RGB16, "VIPS_INTERPRETATION_RGB16", "rgb16"},
|
||||||
{VIPS_INTERPRETATION_GREY16, "VIPS_INTERPRETATION_GREY16", "grey16"},
|
{VIPS_INTERPRETATION_GREY16, "VIPS_INTERPRETATION_GREY16", "grey16"},
|
||||||
{VIPS_INTERPRETATION_ARRAY, "VIPS_INTERPRETATION_ARRAY", "array"},
|
{VIPS_INTERPRETATION_ARRAY, "VIPS_INTERPRETATION_ARRAY", "array"},
|
||||||
|
{VIPS_INTERPRETATION_scRGB, "VIPS_INTERPRETATION_scRGB", "scrgb"},
|
||||||
{0, NULL, NULL}
|
{0, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -457,7 +457,7 @@ vips_image_sanity( VipsObject *object, VipsBuf *buf )
|
|||||||
image->Coding != VIPS_CODING_NONE &&
|
image->Coding != VIPS_CODING_NONE &&
|
||||||
image->Coding != VIPS_CODING_LABQ &&
|
image->Coding != VIPS_CODING_LABQ &&
|
||||||
image->Coding != VIPS_CODING_RAD) ||
|
image->Coding != VIPS_CODING_RAD) ||
|
||||||
image->Type > VIPS_INTERPRETATION_ARRAY ||
|
image->Type > VIPS_INTERPRETATION_scRGB ||
|
||||||
image->dtype > VIPS_IMAGE_PARTIAL ||
|
image->dtype > VIPS_IMAGE_PARTIAL ||
|
||||||
image->dhint > VIPS_DEMAND_STYLE_ANY )
|
image->dhint > VIPS_DEMAND_STYLE_ANY )
|
||||||
vips_buf_appends( buf, "bad enum\n" );
|
vips_buf_appends( buf, "bad enum\n" );
|
||||||
|
Loading…
Reference in New Issue
Block a user