hackery to get goi working

This commit is contained in:
John Cupitt 2011-12-31 18:22:42 +00:00
parent 0983b50905
commit d0ec401a12
129 changed files with 731 additions and 606 deletions

27
TODO
View File

@ -1,6 +1,29 @@
- automake conditionals are breaking introspection
- remaining warnings
include/vips/type.h:99: Warning: Vips: vips_value_get_area: return value: Missing (transfer) annotation
include/vips/type.h:98: Warning: Vips: vips_value_set_area: argument free_fn: Missing (scope) annotation for callback without GDestroyNotify (valid: call, async)
include/vips/type.h:137: Warning: Vips: vips_value_get_array: return value: Missing (transfer) annotation
include/vips/type.h:156: Warning: Vips: vips_value_get_array_object: return value: Missing (transfer) annotation
include/vips/type.h:86: Warning: Vips: vips_area_new: argument free_fn: Missing (scope) annotation for callback without GDestroyNotify (valid: call, async)
include/vips/type.h:87: Warning: Vips: vips_area_new_blob: argument free_fn: Missing (scope) annotation for callback without GDestroyNotify (valid: call, async)
iofuncs/type.c:518: Warning: Vips: vips_value_get_blob: return value: Missing (transfer) annotation
iofuncs/type.c:471: Warning: Vips: vips_value_set_blob: argument free_fn: Missing (scope) annotation for callback without GDestroyNotify (valid: call, async)
iofuncs/header.c:921: Warning: Vips: vips_image_set_area: argument free_fn: Missing (scope) annotation for callback without GDestroyNotify (valid: call, async)
iofuncs/header.c:993: Warning: Vips: vips_image_set_blob: argument free_fn: Missing (scope) annotation for callback without GDestroyNotify (valid: call, async)
include/vips/object.h:273: Warning: Vips: vips__argument_table_lookup: return value: Unresolved type: 'VipsArgument*'
include/vips/operation.h:81: Warning: Vips: vips_operation_class_print_usage: argument operation_class: Unresolved type: 'VipsOperationClass*'
foreign/foreign.c:383: Warning: Vips: vips_foreign_map: argument fn: Unresolved type: 'VipsSListMap2Fn'
foreign/foreign.c:399: Warning: Vips: vips_foreign_map: return value: Missing (transfer) annotation
conversion/im_system_image.c:129: Warning: Vips: im_system_image: return value: Missing (transfer) annotation
we need to build all of them, but use ifdefs to knock chunks out

View File

@ -55,7 +55,8 @@ vips_introspection_sources="$introspection_sources2"
# add headers that form the public vips8 API .. don't do a find and exclude,
# we end up excluding almost everything argh
headers="vips.h object.h image.h error.h foreign.h interpolate.h header.h operation.h enumtypes.h arithmetic.h conversion.h"
headers="vips.h object.h image.h error.h foreign.h interpolate.h header.h
operation.h enumtypes.h arithmetic.h conversion.h type.h"
for name in $headers; do
vips_introspection_sources="$vips_introspection_sources include/vips/$name"
done
@ -726,10 +727,10 @@ native win32: $vips_os_win32
native OS X: $vips_os_darwin
open files in binary mode: $vips_binary_open
enable debug: $enable_debug
build C++ components: $enable_cxx
evaluate with threads: $enable_threads
build docs with gtkdoc $enable_gtk_doc
gobject introspection $found_introspection
build C++ components: $enable_cxx
build docs with gtkdoc: $enable_gtk_doc
gobject introspection: $found_introspection
* optional packages and modules
use fftw3 for FFT: $with_fftw3

View File

@ -164,7 +164,8 @@ vips_abs_build( VipsObject *object )
#endif /*HAVE_HYPOT*/
static void
vips_abs_buffer( VipsArithmetic *arithmetic, PEL *out, PEL **in, int width )
vips_abs_buffer( VipsArithmetic *arithmetic,
VipsPel *out, VipsPel **in, int width )
{
VipsUnary *unary = VIPS_UNARY( arithmetic );
const int bands = vips_image_get_bands( unary->in );

View File

@ -96,7 +96,7 @@ G_DEFINE_TYPE( VipsAdd, vips_add, VIPS_TYPE_BINARY );
}
static void
add_buffer( VipsArithmetic *arithmetic, PEL *out, PEL **in, int width )
add_buffer( VipsArithmetic *arithmetic, VipsPel *out, VipsPel **in, int width )
{
VipsArithmeticClass *class = VIPS_ARITHMETIC_GET_CLASS( arithmetic );
VipsImage *im = arithmetic->ready[0];

View File

@ -270,7 +270,7 @@ vips_arithmetic_gen( VipsRegion *or,
VipsArithmeticClass *class = VIPS_ARITHMETIC_GET_CLASS( arithmetic );
Rect *r = &or->valid;
PEL *p[MAX_INPUT_IMAGES], *q;
VipsPel *p[MAX_INPUT_IMAGES], *q;
int i, y;
/* Prepare all input regions and make buffer pointers.
@ -278,10 +278,10 @@ vips_arithmetic_gen( VipsRegion *or,
for( i = 0; ir[i]; i++ ) {
if( vips_region_prepare( ir[i], r ) )
return( -1 );
p[i] = (PEL *) VIPS_REGION_ADDR( ir[i], r->left, r->top );
p[i] = (VipsPel *) VIPS_REGION_ADDR( ir[i], r->left, r->top );
}
p[i] = NULL;
q = (PEL *) VIPS_REGION_ADDR( or, r->left, r->top );
q = (VipsPel *) VIPS_REGION_ADDR( or, r->left, r->top );
for( y = 0; y < r->height; y++ ) {
class->process_line( arithmetic, q, p, r->width );

View File

@ -58,7 +58,7 @@ extern "C" {
struct _VipsArithmetic;
typedef void (*VipsArithmeticProcessFn)( struct _VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width );
VipsPel *out, VipsPel **in, int width );
typedef struct _VipsArithmetic {
VipsOperation parent_instance;

View File

@ -140,7 +140,7 @@ vips_boolean_build( VipsObject *object )
static void
vips_boolean_buffer( VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width )
VipsPel *out, VipsPel **in, int width )
{
VipsBoolean *boolean = (VipsBoolean *) arithmetic;
VipsImage *im = arithmetic->ready[0];
@ -462,7 +462,7 @@ vips_boolean_const_build( VipsObject *object )
static void
vips_boolean_const_buffer( VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width )
VipsPel *out, VipsPel **in, int width )
{
VipsUnaryConst *uconst = (VipsUnaryConst *) arithmetic;
VipsBooleanConst *bconst = (VipsBooleanConst *) arithmetic;

View File

@ -163,7 +163,8 @@ G_DEFINE_TYPE( VipsComplex, vips_complex, VIPS_TYPE_UNARY );
}
static void
vips_complex_buffer( VipsArithmetic *arithmetic, PEL *out, PEL **in, int width )
vips_complex_buffer( VipsArithmetic *arithmetic,
VipsPel *out, VipsPel **in, int width )
{
VipsComplex *cmplx = (VipsComplex *) arithmetic;
VipsImage *im = arithmetic->ready[0];
@ -418,7 +419,7 @@ vips_complexget_build( VipsObject *object )
static void
vips_complexget_buffer( VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width )
VipsPel *out, VipsPel **in, int width )
{
VipsComplexget *complexget = (VipsComplexget *) arithmetic;
VipsImage *im = arithmetic->ready[0];
@ -608,7 +609,7 @@ vips_complexform_build( VipsObject *object )
static void
vips_complexform_buffer( VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width )
VipsPel *out, VipsPel **in, int width )
{
VipsImage *im = arithmetic->ready[0];
const int sz = width * vips_image_get_bands( im );

View File

@ -152,7 +152,7 @@ G_DEFINE_TYPE( VipsDivide, vips_divide, VIPS_TYPE_BINARY );
static void
vips_divide_buffer( VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width )
VipsPel *out, VipsPel **in, int width )
{
VipsImage *im = arithmetic->ready[0];
const int sz = width * vips_image_get_bands( im );

View File

@ -186,7 +186,7 @@ maxposavg_scan( REGION *reg, void *seq, void *a, void *b, gboolean *stop )
occurences = maxposavg->occurences;
for( y = 0; y < r->height; y++ ) {
PEL *in = (PEL *) IM_REGION_ADDR( reg, r->left, r->top + y );
VipsPel *in = VIPS_REGION_ADDR( reg, r->left, r->top + y );
switch( reg->im->BandFmt ) {
case IM_BANDFMT_UCHAR: LOOP( unsigned char ); break;

View File

@ -82,7 +82,8 @@ G_DEFINE_TYPE( VipsInvert, vips_invert, VIPS_TYPE_UNARY );
}
static void
vips_invert_buffer( VipsArithmetic *arithmetic, PEL *out, PEL **in, int width )
vips_invert_buffer( VipsArithmetic *arithmetic,
VipsPel *out, VipsPel **in, int width )
{
VipsImage *im = arithmetic->ready[0];

View File

@ -187,7 +187,8 @@ vips_linear_build( VipsObject *object )
/* Lintra a buffer, n set of scale/offset.
*/
static void
vips_linear_buffer( VipsArithmetic *arithmetic, PEL *out, PEL **in, int width )
vips_linear_buffer( VipsArithmetic *arithmetic,
VipsPel *out, VipsPel **in, int width )
{
VipsImage *im = arithmetic->ready[0];
VipsLinear *linear = (VipsLinear *) arithmetic;

View File

@ -139,7 +139,8 @@ vips_math_build( VipsObject *object )
#define EXP10( X ) (pow( 10.0, (X) ))
static void
vips_math_buffer( VipsArithmetic *arithmetic, PEL *out, PEL **in, int width )
vips_math_buffer( VipsArithmetic *arithmetic,
VipsPel *out, VipsPel **in, int width )
{
VipsMath *math = (VipsMath *) arithmetic;
VipsImage *im = arithmetic->ready[0];

View File

@ -145,7 +145,7 @@ vips_math2_build( VipsObject *object )
static void
vips_math2_buffer( VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width )
VipsPel *out, VipsPel **in, int width )
{
VipsMath2 *math2 = (VipsMath2 *) arithmetic;
VipsImage *im = arithmetic->ready[0];
@ -361,7 +361,7 @@ vips_math2_const_build( VipsObject *object )
static void
vips_math2_const_buffer( VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width )
VipsPel *out, VipsPel **in, int width )
{
VipsUnaryConst *uconst = (VipsUnaryConst *) arithmetic;
VipsMath2Const *math2 = (VipsMath2Const *) arithmetic;

View File

@ -324,9 +324,12 @@ vips_max_init( VipsMax *max )
* vips_max:
* @in: input #VipsImage
* @out: output pixel maximum
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @x: horizontal position of maximum
* @y: vertical position of maximum
* @...: %NULL-terminated list of optional named arguments
*
* This operation finds the maximum value in an image.
*

View File

@ -259,11 +259,14 @@ vips_measure_init( VipsMeasure *measure )
* @out: array of measurements
* @h: patches across chart
* @v: patches down chart
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @left: area of image containing chart
* @top: area of image containing chart
* @width: area of image containing chart
* @height: area of image containing chart
* @...: %NULL-terminated list of optional named arguments
*
* Analyse a grid of colour patches, producing an array of patch averages.
* The mask has a row for each measured patch and a column for each image

View File

@ -325,9 +325,12 @@ vips_min_init( VipsMin *min )
* vips_min:
* @in: input #VipsImage
* @out: output pixel maximum
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @x: horizontal position of minimum
* @y: vertical position of minimum
* @...: %NULL-terminated list of optional named arguments
*
* This operation finds the minimum value in an image.
*

View File

@ -113,7 +113,7 @@ G_DEFINE_TYPE( VipsMultiply, vips_multiply, VIPS_TYPE_BINARY );
static void
vips_multiply_buffer( VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width )
VipsPel *out, VipsPel **in, int width )
{
VipsImage *im = arithmetic->ready[0];
const int sz = width * vips_image_get_bands( im );
@ -183,11 +183,11 @@ vips_multiply_init( VipsMultiply *multiply )
/**
* vips_multiply:
* @in1: input #VipsImage 1
* @in2: input #VipsImage 2
* @out: output #VipsImage
* @left: left-hand image
* @right: right-hand image
* @out: output image
*
* This operation calculates @in1 * @in2 and writes the result to @out.
* This operation calculates @left * @right and writes the result to @out.
*
* If the images differ in size, the smaller image is enlarged to match the
* larger by adding zero pixels along the bottom and right.

View File

@ -109,7 +109,7 @@ vips_relational_build( VipsObject *object )
#define RLOOP( TYPE, ROP ) { \
TYPE *left = (TYPE *) in[0]; \
TYPE *right = (TYPE *) in[1]; \
PEL *q = (PEL *) out; \
VipsPel *q = (VipsPel *) out; \
\
for( x = 0; x < sz; x++ ) \
q[x] = (left[x] ROP right[x]) ? 255 : 0; \
@ -118,7 +118,7 @@ vips_relational_build( VipsObject *object )
#define CLOOP( TYPE, COP ) { \
TYPE *left = (TYPE *) in[0]; \
TYPE *right = (TYPE *) in[1]; \
PEL *q = (PEL *) out; \
VipsPel *q = (VipsPel *) out; \
\
for( x = 0; x < sz; x++ ) { \
q[x] = COP( left[0], left[1], right[0], right[1]) ? 255 : 0; \
@ -154,7 +154,7 @@ vips_relational_build( VipsObject *object )
static void
vips_relational_buffer( VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width )
VipsPel *out, VipsPel **in, int width )
{
VipsRelational *relational = (VipsRelational *) arithmetic;
VipsImage *im = arithmetic->ready[0];
@ -496,7 +496,7 @@ vips_relational_const_build( VipsObject *object )
static void
vips_relational_const_buffer( VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width )
VipsPel *out, VipsPel **in, int width )
{
VipsUnaryConst *uconst = (VipsUnaryConst *) arithmetic;
VipsRelationalConst *rconst = (VipsRelationalConst *) arithmetic;

View File

@ -121,7 +121,7 @@ vips_remainder_build( VipsObject *object )
static void
vips_remainder_buffer( VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width )
VipsPel *out, VipsPel **in, int width )
{
VipsImage *im = arithmetic->ready[0];
const int sz = width * vips_image_get_bands( im );
@ -289,7 +289,7 @@ vips_remainder_const_build( VipsObject *object )
static void
vips_remainder_const_buffer( VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width )
VipsPel *out, VipsPel **in, int width )
{
VipsUnaryConst *uconst = (VipsUnaryConst *) arithmetic;
VipsImage *im = arithmetic->ready[0];

View File

@ -105,7 +105,8 @@ vips_round_build( VipsObject *object )
}
static void
vips_round_buffer( VipsArithmetic *arithmetic, PEL *out, PEL **in, int width )
vips_round_buffer( VipsArithmetic *arithmetic,
VipsPel *out, VipsPel **in, int width )
{
VipsRound *round = (VipsRound *) arithmetic;
VipsImage *im = arithmetic->ready[0];

View File

@ -99,7 +99,8 @@ G_DEFINE_TYPE( VipsSign, vips_sign, VIPS_TYPE_UNARY );
}
static void
vips_sign_buffer( VipsArithmetic *arithmetic, PEL *out, PEL **in, int width )
vips_sign_buffer( VipsArithmetic *arithmetic,
VipsPel *out, VipsPel **in, int width )
{
VipsUnary *unary = VIPS_UNARY( arithmetic );
const int bands = vips_image_get_bands( unary->in );

View File

@ -74,12 +74,12 @@ vips_statistic_scan( VipsRegion *region,
int lsk = IM_REGION_LSKIP( region );
int y;
PEL *p;
VipsPel *p;
VIPS_DEBUG_MSG( "vips_statistic_scan: %d x %d @ %d x %d\n",
r->width, r->height, r->left, r->top );
p = (PEL *) IM_REGION_ADDR( region, r->left, r->top );
p = VIPS_REGION_ADDR( region, r->left, r->top );
for( y = 0; y < r->height; y++ ) {
if( class->scan( statistic,
seq, r->left, r->top + y, p, r->width ) )

View File

@ -92,7 +92,7 @@ G_DEFINE_TYPE( VipsSubtract, vips_subtract, VIPS_TYPE_BINARY );
static void
vips_subtract_buffer( VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width )
VipsPel *out, VipsPel **in, int width )
{
VipsImage *im = arithmetic->ready[0];

View File

@ -84,14 +84,14 @@ G_DEFINE_ABSTRACT_TYPE( VipsUnaryConst, vips_unary_const, VIPS_TYPE_UNARY );
/* Cast a n-band vector of double to a m-band vector in another format.
*/
static PEL *
static VipsPel *
make_pixel( VipsObject *obj, int m, VipsBandFmt fmt, int n, double *p )
{
PEL *q;
VipsPel *q;
int i;
if( !(q = VIPS_ARRAY( obj,
m * vips__image_sizeof_bandformat[fmt], PEL )) )
m * vips__image_sizeof_bandformat[fmt], VipsPel )) )
return( NULL );
switch( fmt ) {

View File

@ -67,7 +67,7 @@ typedef struct _VipsUnaryConst {
* const_format in type.
*/
int n;
PEL *c_ready;
VipsPel *c_ready;
} VipsUnaryConst;

View File

@ -55,13 +55,13 @@
/* imb_LabQ2Lab: CONVERT n pels from packed 32bit Lab to float values
* in a buffer
* ARGS: PEL *inp pointer to first byte of Lab32 buffer
* ARGS: VipsPel *inp pointer to first byte of Lab32 buffer
* float *outbuf destination buffer
* int n number of pels to process
* (C) K.Martinez 2/5/93
*/
void
imb_LabQ2Lab( PEL *inp, float *outbuf, int n )
imb_LabQ2Lab( VipsPel *inp, float *outbuf, int n )
{
signed char *b; /* to read input bytes */
int l;

View File

@ -51,9 +51,9 @@
*/
typedef struct {
struct im_col_display *disp;
PEL red[ 64 * 64 * 64 ];
PEL green[ 64 * 64 * 64 ];
PEL blue[ 64 * 64 * 64 ];
VipsPel red[ 64 * 64 * 64 ];
VipsPel green[ 64 * 64 * 64 ];
VipsPel blue[ 64 * 64 * 64 ];
} CalibrateInfo;
/* Do our own indexing of the arrays, to make sure we get efficient mults.
@ -63,7 +63,7 @@ typedef struct {
/* Process a buffer of data.
*/
static void
imb_LabQ2disp( PEL *p, PEL *q, int n, CalibrateInfo *cal )
imb_LabQ2disp( VipsPel *p, VipsPel *q, int n, CalibrateInfo *cal )
{
int x, t;

View File

@ -65,7 +65,7 @@
/* Process a buffer of data.
*/
void
imb_XYZ2disp( float *p, PEL *q, int n, struct im_col_display *d )
imb_XYZ2disp( float *p, VipsPel *q, int n, struct im_col_display *d )
{
struct im_col_tab_disp *table = im_col_display_get_table( d );
float rstep = (d->d_YCR - d->d_Y0R) / 1500.0;

View File

@ -41,7 +41,7 @@
#include <vips/vips.h>
static void
argb2rgba( guint32 *in, PEL *out, int n, void *_bg )
argb2rgba( guint32 *in, VipsPel *out, int n, void *_bg )
{
guint32 bg = GPOINTER_TO_UINT( _bg );

View File

@ -55,7 +55,7 @@
/* Convert a buffer.
*/
void
imb_disp2XYZ( PEL *p, float *q, int n, struct im_col_display *d )
imb_disp2XYZ( VipsPel *p, float *q, int n, struct im_col_display *d )
{
int x;

View File

@ -299,7 +299,7 @@ decode_lab( WORD *fixed, float *lab, int n )
}
static void
transform_buf( PEL *in, PEL *out, int n, Icc *icc )
transform_buf( VipsPel *in, VipsPel *out, int n, Icc *icc )
{
g_mutex_lock( icc->lock );
cmsDoTransform( icc->trans, in, out, n );
@ -462,7 +462,7 @@ im_icc_transform( IMAGE *in, IMAGE *out,
}
static void
import_buf( PEL *in, float *out, int n, Icc *icc )
import_buf( VipsPel *in, float *out, int n, Icc *icc )
{
/* Buffer of encoded 16-bit pixels we write to.
*/
@ -644,7 +644,7 @@ im_icc_import_embedded( IMAGE *in, IMAGE *out, VipsIntent intent )
}
static void
export_buf( float *in, PEL *out, int n, Icc *icc )
export_buf( float *in, VipsPel *out, int n, Icc *icc )
{
/* Buffer of encoded 16-bit pixels we transform.
*/
@ -1103,7 +1103,7 @@ decode_lab( guint16 *fixed, float *lab, int n )
}
static void
transform_buf( PEL *in, PEL *out, int n, Icc *icc )
transform_buf( VipsPel *in, VipsPel *out, int n, Icc *icc )
{
g_mutex_lock( icc->lock );
cmsDoTransform( icc->trans, in, out, n );
@ -1273,7 +1273,7 @@ im_icc_transform( IMAGE *in, IMAGE *out,
}
static void
import_buf( PEL *in, float *out, int n, Icc *icc )
import_buf( VipsPel *in, float *out, int n, Icc *icc )
{
/* Buffer of encoded 16-bit pixels we write to.
*/
@ -1437,7 +1437,7 @@ im_icc_import_embedded( IMAGE *in, IMAGE *out, VipsIntent intent )
}
static void
export_buf( float *in, PEL *out, int n, Icc *icc )
export_buf( float *in, VipsPel *out, int n, Icc *icc )
{
/* Buffer of encoded 16-bit pixels we transform.
*/

View File

@ -88,16 +88,16 @@ vips_bandary_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop )
VipsBandaryClass *class = VIPS_BANDARY_GET_CLASS( bandary );
Rect *r = &or->valid;
PEL *p[MAX_INPUT_IMAGES], *q;
VipsPel *p[MAX_INPUT_IMAGES], *q;
int y, i;
for( i = 0; i < bandary->n; i++ ) {
if( vips_region_prepare( ir[i], r ) )
return( -1 );
p[i] = (PEL *) VIPS_REGION_ADDR( ir[i], r->left, r->top );
p[i] = VIPS_REGION_ADDR( ir[i], r->left, r->top );
}
p[i] = NULL;
q = (PEL *) VIPS_REGION_ADDR( or, r->left, r->top );
q = VIPS_REGION_ADDR( or, r->left, r->top );
for( y = 0; y < r->height; y++ ) {
class->process_line( bandary, q, p, r->width );

View File

@ -53,7 +53,7 @@ extern "C" {
struct _VipsBandary;
typedef void (*VipsBandaryProcessFn)( struct _VipsBandary *bandary,
PEL *out, PEL **in, int width );
VipsPel *out, VipsPel **in, int width );
typedef struct _VipsBandary {
VipsConversion parent_instance;

View File

@ -85,7 +85,7 @@ typedef VipsBandaryClass VipsBandjoinClass;
G_DEFINE_TYPE( VipsBandjoin, vips_bandjoin, VIPS_TYPE_BANDARY );
static void
vips_bandjoin_buffer( VipsBandary *bandary, PEL *q, PEL **p, int width )
vips_bandjoin_buffer( VipsBandary *bandary, VipsPel *q, VipsPel **p, int width )
{
VipsConversion *conversion = (VipsConversion *) bandary;
VipsImage **in = bandary->ready;
@ -104,7 +104,7 @@ vips_bandjoin_buffer( VipsBandary *bandary, PEL *q, PEL **p, int width )
*/
int ips = VIPS_IMAGE_SIZEOF_PEL( in[i] );
PEL *p1, *q1;
VipsPel *p1, *q1;
int x, z;
q1 = q;

View File

@ -119,7 +119,8 @@ G_DEFINE_TYPE( VipsBandmean, vips_bandmean, VIPS_TYPE_BANDARY );
}
static void
vips_bandmean_buffer( VipsBandary *bandary, PEL *out, PEL **in, int width )
vips_bandmean_buffer( VipsBandary *bandary,
VipsPel *out, VipsPel **in, int width )
{
VipsImage *im = bandary->ready[0];
const int bands = im->Bands;

View File

@ -157,9 +157,12 @@ vips_black_init( VipsBlack *black )
* @out: output image
* @width: output width
* @height: output height
* @bands: output bands
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @bands: output bands
*
* Make a black unsigned char image of a specified size.
*
* See also: im_make_xy(), im_text(), im_gaussnoise().

View File

@ -335,8 +335,8 @@ vips_cast_gen( VipsRegion *or, void *vseq, void *a, void *b,
return( -1 );
for( y = to; y < bo; y++ ) {
PEL *in = (PEL *) VIPS_REGION_ADDR( ir, le, y );
PEL *out = (PEL *) VIPS_REGION_ADDR( or, le, y );
VipsPel *in = VIPS_REGION_ADDR( ir, le, y );
VipsPel *out = VIPS_REGION_ADDR( or, le, y );
switch( cast->in->BandFmt ) {
case VIPS_FORMAT_UCHAR:

View File

@ -127,7 +127,7 @@ G_DEFINE_TYPE( VipsCopy, vips_copy, VIPS_TYPE_CONVERSION );
/* Swap pairs of bytes.
*/
static void
vips_copy_swap2( PEL *in, PEL *out, int width, VipsImage *im )
vips_copy_swap2( VipsPel *in, VipsPel *out, int width, VipsImage *im )
{
guint16 *p = (guint16 *) in;
guint16 *q = (guint16 *) out;
@ -142,7 +142,7 @@ vips_copy_swap2( PEL *in, PEL *out, int width, VipsImage *im )
/* Swap 4- of bytes.
*/
static void
vips_copy_swap4( PEL *in, PEL *out, int width, VipsImage *im )
vips_copy_swap4( VipsPel *in, VipsPel *out, int width, VipsImage *im )
{
guint32 *p = (guint32 *) in;
guint32 *q = (guint32 *) out;
@ -157,7 +157,7 @@ vips_copy_swap4( PEL *in, PEL *out, int width, VipsImage *im )
/* Swap 8- of bytes.
*/
static void
vips_copy_swap8( PEL *in, PEL *out, int width, VipsImage *im )
vips_copy_swap8( VipsPel *in, VipsPel *out, int width, VipsImage *im )
{
guint64 *p = (guint64 *) in;
guint64 *q = (guint64 *) out;
@ -169,7 +169,7 @@ vips_copy_swap8( PEL *in, PEL *out, int width, VipsImage *im )
q[x] = GUINT64_SWAP_LE_BE( p[x] );
}
typedef void (*SwapFn)( PEL *in, PEL *out, int width, VipsImage *im );
typedef void (*SwapFn)( VipsPel *in, VipsPel *out, int width, VipsImage *im );
static SwapFn vips_copy_swap_fn[] = {
NULL, /* VIPS_FORMAT_UCHAR = 0, */
@ -203,9 +203,9 @@ vips_copy_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop )
int y;
for( y = 0; y < r->height; y++ ) {
PEL *p = (PEL *) VIPS_REGION_ADDR( ir,
VipsPel *p = VIPS_REGION_ADDR( ir,
r->left, r->top + y );
PEL *q = (PEL *) VIPS_REGION_ADDR( or,
VipsPel *q = VIPS_REGION_ADDR( or,
r->left, r->top + y );
swap( p, q, r->width, copy->in );
@ -401,6 +401,10 @@ vips_copy_init( VipsCopy *copy )
* vips_copy:
* @in: input image
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @width: set image width
* @height: set image height
* @bands: set image bands
@ -412,7 +416,6 @@ vips_copy_init( VipsCopy *copy )
* @xoffset: set image xoffset
* @yoffset: set image yoffset
* @swap: swap byte order
* @...: %NULL-terminated list of optional named arguments
*
* Copy an image, optionally modifying the header. VIPS copies images by
* copying pointers, so this operation is instant, even for very large images.

View File

@ -143,7 +143,7 @@ vips_embed_find_edge( VipsEmbed *embed, VipsRect *r, int i, VipsRect *out )
/* Copy a single pixel sideways into a line of pixels.
*/
static void
vips_embed_copy_pixel( VipsEmbed *embed, PEL *q, PEL *p, int n )
vips_embed_copy_pixel( VipsEmbed *embed, VipsPel *q, VipsPel *p, int n )
{
const int bs = VIPS_IMAGE_SIZEOF_PEL( embed->in );
@ -160,12 +160,12 @@ vips_embed_copy_pixel( VipsEmbed *embed, PEL *q, PEL *p, int n )
*/
static void
vips_embed_paint_edge( VipsEmbed *embed,
VipsRegion *or, int i, VipsRect *r, PEL *p, int plsk )
VipsRegion *or, int i, VipsRect *r, VipsPel *p, int plsk )
{
const int bs = VIPS_IMAGE_SIZEOF_PEL( embed->in );
VipsRect todo;
PEL *q;
VipsPel *q;
int y;
/* Pixels left to paint.
@ -176,7 +176,7 @@ vips_embed_paint_edge( VipsEmbed *embed,
* todo, then use the line copier below to paint the rest of it.
*/
if( i > 3 ) {
q = (PEL *) VIPS_REGION_ADDR( or, todo.left, todo.top );
q = VIPS_REGION_ADDR( or, todo.left, todo.top );
vips_embed_copy_pixel( embed, q, p, todo.width );
p = q;
@ -188,8 +188,7 @@ vips_embed_paint_edge( VipsEmbed *embed,
/* Vertical line of pixels to copy.
*/
for( y = 0; y < todo.height; y++ ) {
q = (PEL *) VIPS_REGION_ADDR( or,
todo.left, todo.top + y );
q = VIPS_REGION_ADDR( or, todo.left, todo.top + y );
vips_embed_copy_pixel( embed, q, p, todo.width );
p += plsk;
}
@ -198,8 +197,7 @@ vips_embed_paint_edge( VipsEmbed *embed,
/* Horizontal line of pixels to copy.
*/
for( y = 0; y < todo.height; y++ ) {
q = (PEL *) VIPS_REGION_ADDR( or,
todo.left, todo.top + y );
q = VIPS_REGION_ADDR( or, todo.left, todo.top + y );
memcpy( q, p, bs * todo.width );
}
}
@ -214,7 +212,7 @@ vips_embed_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop )
Rect ovl;
int i;
PEL *p;
VipsPel *p;
int plsk;
/* Entirely within the input image? Generate the subimage and copy
@ -275,7 +273,7 @@ vips_embed_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop )
* that.
*/
if( !vips_rect_isempty( &ovl ) ) {
p = (PEL *) VIPS_REGION_ADDR( or,
p = VIPS_REGION_ADDR( or,
edge.left, edge.top );
plsk = VIPS_REGION_LSKIP( or );
}
@ -287,7 +285,7 @@ vips_embed_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop )
edge.top -= embed->y;
if( vips_region_prepare( ir, &edge ) )
return( -1 );
p = (PEL *) VIPS_REGION_ADDR( ir,
p = VIPS_REGION_ADDR( ir,
edge.left, edge.top );
plsk = VIPS_REGION_LSKIP( ir );
}
@ -567,13 +565,16 @@ vips_embed_init( VipsEmbed *embed )
* vips_embed:
* @in: input image
* @out: output image
* @width: @out should be this many pixels across
* @height: @out should be this many pixels down
* @x: place @in at this x position in @out
* @y: place @in at this y position in @out
* @extend: how to generate the edge pixels
* @width: @out should be this many pixels across
* @height: @out should be this many pixels down
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @extend: how to generate the edge pixels
*
* The opposite of vips_extract_area(): embed @in within an image of size
* @width by @height at position @x, @y. @extend
* controls what appears in the new pels, see #VipsExtend.

View File

@ -278,7 +278,8 @@ typedef VipsBandaryClass VipsExtractBandClass;
G_DEFINE_TYPE( VipsExtractBand, vips_extract_band, VIPS_TYPE_BANDARY );
static void
vips_extract_band_buffer( VipsBandary *bandary, PEL *out, PEL **in, int width )
vips_extract_band_buffer( VipsBandary *bandary,
VipsPel *out, VipsPel **in, int width )
{
VipsConversion *conversion = (VipsConversion *) bandary;
VipsExtractBand *extract = (VipsExtractBand *) bandary;
@ -287,7 +288,7 @@ vips_extract_band_buffer( VipsBandary *bandary, PEL *out, PEL **in, int width )
int ips = VIPS_IMAGE_SIZEOF_PEL( im );
const int ops = VIPS_IMAGE_SIZEOF_PEL( conversion->out );
PEL *p, *q;
VipsPel *p, *q;
int x, z;
p = in[0] + extract->band * es;
@ -381,9 +382,12 @@ vips_extract_band_init( VipsExtractBand *extract )
* @in: input image
* @out: output image
* @band: band to extract
* @n: number of bands to extract
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @n: number of bands to extract
*
* Extract a band or bands from an image. Extracting out of range is an error.
*
* See also: vips_extract_area().

View File

@ -88,7 +88,7 @@ vips_flip_vertical_gen( VipsRegion *or, void *seq, void *a, void *b,
VipsRegion *ir = (VipsRegion *) seq;
VipsRect *r = &or->valid;
VipsRect in;
PEL *p, *q;
VipsPel *p, *q;
int y;
int le = r->left;
@ -110,8 +110,8 @@ vips_flip_vertical_gen( VipsRegion *or, void *seq, void *a, void *b,
/* Loop, copying and reversing lines.
*/
p = (PEL *) VIPS_REGION_ADDR( ir, le, in.top + in.height - 1 );
q = (PEL *) VIPS_REGION_ADDR( or, le, to );
p = VIPS_REGION_ADDR( ir, le, in.top + in.height - 1 );
q = VIPS_REGION_ADDR( or, le, to );
psk = VIPS_REGION_LSKIP( ir );
qsk = VIPS_REGION_LSKIP( or );
ls = VIPS_REGION_SIZEOF_LINE( or );
@ -133,7 +133,7 @@ vips_flip_horizontal_gen( VipsRegion *or, void *seq, void *a, void *b,
VipsRegion *ir = (VipsRegion *) seq;
VipsRect *r = &or->valid;
VipsRect in;
PEL *p, *q;
VipsPel *p, *q;
int x, y, z;
int le = r->left;

View File

@ -172,7 +172,8 @@ G_DEFINE_TYPE( VipsIfthenelse, vips_ifthenelse, VIPS_TYPE_CONVERSION );
/* Blend with a 1-band conditional image.
*/
static void
vips_blend1_buffer( PEL *qp, PEL *c, PEL *ap, PEL *bp, int width,
vips_blend1_buffer( VipsPel *qp,
VipsPel *c, VipsPel *ap, VipsPel *bp, int width,
VipsImage *im )
{
int i, x, z;
@ -199,7 +200,8 @@ vips_blend1_buffer( PEL *qp, PEL *c, PEL *ap, PEL *bp, int width,
/* Blend with a many band conditional image.
*/
static void
vips_blendn_buffer( PEL *qp, PEL *c, PEL *ap, PEL *bp, int width,
vips_blendn_buffer( VipsPel *qp,
VipsPel *c, VipsPel *ap, VipsPel *bp, int width,
VipsImage *im )
{
int x, z;
@ -261,10 +263,10 @@ vips_ifthenelse_gen( VipsRegion *or, void *seq, void *client1, void *client2,
/* Is the conditional all zero or all non-zero? We can avoid asking
* for one of the inputs to be calculated.
*/
all0 = *((PEL *) VIPS_REGION_ADDR( ir[2], le, to )) == 0;
alln0 = *((PEL *) VIPS_REGION_ADDR( ir[2], le, to )) != 0;
all0 = *VIPS_REGION_ADDR( ir[2], le, to ) == 0;
alln0 = *VIPS_REGION_ADDR( ir[2], le, to ) != 0;
for( y = to; y < bo; y++ ) {
PEL *p = (PEL *) VIPS_REGION_ADDR( ir[2], le, y );
VipsPel *p = VIPS_REGION_ADDR( ir[2], le, y );
for( x = 0; x < width; x++ ) {
all0 &= p[x] == 0;
@ -298,10 +300,10 @@ vips_ifthenelse_gen( VipsRegion *or, void *seq, void *client1, void *client2,
return( -1 );
for( y = to; y < bo; y++ ) {
PEL *ap = (PEL *) VIPS_REGION_ADDR( ir[0], le, y );
PEL *bp = (PEL *) VIPS_REGION_ADDR( ir[1], le, y );
PEL *cp = (PEL *) VIPS_REGION_ADDR( ir[2], le, y );
PEL *q = (PEL *) VIPS_REGION_ADDR( or, le, y );
VipsPel *ap = VIPS_REGION_ADDR( ir[0], le, y );
VipsPel *bp = VIPS_REGION_ADDR( ir[1], le, y );
VipsPel *cp = VIPS_REGION_ADDR( ir[2], le, y );
VipsPel *q = VIPS_REGION_ADDR( or, le, y );
if( ifthenelse->blend ) {
if( c->Bands == 1 )

View File

@ -341,7 +341,7 @@ im_falsecolour( IMAGE *in, IMAGE *out )
return( -1 );
in = t[1];
if( !(lut = im_image( (PEL *) PET_colour,
if( !(lut = im_image( (VipsPel *) PET_colour,
1, 256, 3, IM_BANDFMT_UCHAR )) )
return( -1 );
if( im_maplut( in, out, lut ) ) {

View File

@ -85,8 +85,8 @@ line_shrink_gen( REGION *or, void *seq, void *a, void *b )
/* Loop down the region.
*/
for( y = to; y < bo; y++ ) {
PEL *q = IM_REGION_ADDR( or, le, y );
PEL *p;
VipsPel *q = IM_REGION_ADDR( or, le, y );
VipsPel *p;
/* Loop across the region, in owidth sized pieces.
*/
@ -149,8 +149,8 @@ point_shrink_gen( REGION *or, void *seq, void *a, void *b )
/* Loop down the region.
*/
for( y = to; y < bo; y++ ) {
PEL *q = IM_REGION_ADDR( or, le, y );
PEL *p;
VipsPel *q = IM_REGION_ADDR( or, le, y );
VipsPel *p;
/* Loop across the region, in owidth sized pieces.
*/

View File

@ -94,7 +94,7 @@ text_ft_to_vips( FT_Bitmap *bitmap, IMAGE *out )
for( y = 0; y < bitmap->rows; y++ )
if( im_writeline( y, out,
(PEL *) bitmap->buffer + y * bitmap->pitch ) )
(VipsPel *) bitmap->buffer + y * bitmap->pitch ) )
return( -1 );
return( 0 );

View File

@ -122,9 +122,9 @@ paint_whole( REGION *or, REGION *ir, ZoomInfo *zm,
/* Loop over input, as we know we are all whole.
*/
for( y = itop; y < ibottom; y++ ) {
PEL *p = (PEL *) IM_REGION_ADDR( ir, ileft, y );
PEL *q = (PEL *) IM_REGION_ADDR( or, left, y * zm->yfac );
PEL *r;
VipsPel *p = IM_REGION_ADDR( ir, ileft, y );
VipsPel *q = IM_REGION_ADDR( or, left, y * zm->yfac );
VipsPel *r;
/* Expand the first line of pels.
*/
@ -184,9 +184,9 @@ paint_part( REGION *or, REGION *ir, const ZoomInfo *zm,
/* Have to loop over output.
*/
for( y = top; y < bottom; ) {
PEL *p = (PEL *) IM_REGION_ADDR( ir, ix, y / zm->yfac );
PEL *q = (PEL *) IM_REGION_ADDR( or, left, y );
PEL *r;
VipsPel *p = IM_REGION_ADDR( ir, ix, y / zm->yfac );
VipsPel *q = IM_REGION_ADDR( or, left, y );
VipsPel *r;
/* Output pels until we jump the input pointer.
*/

View File

@ -89,7 +89,7 @@ typedef struct _VipsInsert {
/* Pixel we paint calculated from background.
*/
PEL *ink;
VipsPel *ink;
/* Inputs cast and banded up.
*/
@ -209,7 +209,7 @@ vips_insert_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop )
/* Calculate a pixel for an image from a vec of double. Valid while im is
* valid.
*/
PEL *
VipsPel *
vips__vector_to_ink( const char *domain, VipsImage *im, double *vec, int n )
{
VipsImage **t;
@ -237,14 +237,14 @@ vips__vector_to_ink( const char *domain, VipsImage *im, double *vec, int n )
#ifdef VIPS_DEBUG
{
PEL *p = (PEL *) (t[3]->data);
VipsPel *p = (VipsPel *) (t[3]->data);
printf( "vips__vector_to_ink: ink = %p (%d %d %d)\n",
p, p[0], p[1], p[2] );
}
#endif /*VIPS_DEBUG*/
return( (PEL *) t[3]->data );
return( (VipsPel *) t[3]->data );
}
static int
@ -407,9 +407,12 @@ vips_insert_init( VipsInsert *insert )
* @out: output image
* @x: left position of @sub
* @y: top position of @sub
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @expand: expand output to hold whole of both images
* @background: colour for new pixels
* @...: %NULL-terminated list of optional named arguments
*
* Insert one image into another. @sub is inserted into image @main at
* position @x, @y relative to the top LH corner of @main.

View File

@ -274,11 +274,14 @@ vips_join_init( VipsJoin *join )
* @in2: second input image
* @out: output image
* @direction: join horizontally or vertically
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @expand: %TRUE to expand the output image to hold all of the input pixels
* @shim: space between images, in pixels
* @background: background ink colour
* @align: low, centre or high alignment
* @...: %NULL-terminated list of optional named arguments
*
* Join @in1 and @in2 together, left-right or up-down depending on the value
* of @direction.

View File

@ -113,9 +113,9 @@ vips_recomb_gen( VipsRegion *or,
return( -1 );
for( y = 0; y < or->valid.height; y++ ) {
PEL *in = (PEL *) VIPS_REGION_ADDR( ir,
VipsPel *in = VIPS_REGION_ADDR( ir,
or->valid.left, or->valid.top + y );
PEL *out = (PEL *) VIPS_REGION_ADDR( or,
VipsPel *out = VIPS_REGION_ADDR( or,
or->valid.left, or->valid.top + y );
switch( vips_image_get_format( im ) ) {

View File

@ -132,11 +132,11 @@ vips_rot90_gen( VipsRegion *or, void *seq, void *a, void *b,
for( y = to; y < bo; y++ ) {
/* Start of this output line.
*/
PEL *q = (PEL *) VIPS_REGION_ADDR( or, le, y );
VipsPel *q = VIPS_REGION_ADDR( or, le, y );
/* Corresponding position in ir.
*/
PEL *p = (PEL *) VIPS_REGION_ADDR( ir,
VipsPel *p = VIPS_REGION_ADDR( ir,
need.left + y - to,
need.top + need.height - 1 );
@ -193,11 +193,11 @@ vips_rot180_gen( VipsRegion *or, void *seq, void *a, void *b,
for( y = to; y < bo; y++ ) {
/* Start of this output line.
*/
PEL *q = (PEL *) VIPS_REGION_ADDR( or, le, y );
VipsPel *q = VIPS_REGION_ADDR( or, le, y );
/* Corresponding position in ir.
*/
PEL *p = (PEL *) VIPS_REGION_ADDR( ir,
VipsPel *p = VIPS_REGION_ADDR( ir,
need.left + need.width - 1,
need.top + need.height - (y - to) - 1 );
@ -255,11 +255,11 @@ vips_rot270_gen( VipsRegion *or, void *seq, void *a, void *b,
for( y = to; y < bo; y++ ) {
/* Start of this output line.
*/
PEL *q = (PEL *) VIPS_REGION_ADDR( or, le, y );
VipsPel *q = VIPS_REGION_ADDR( or, le, y );
/* Corresponding position in ir.
*/
PEL *p = (PEL *) VIPS_REGION_ADDR( ir,
VipsPel *p = VIPS_REGION_ADDR( ir,
need.left + need.width - (y - to) - 1,
need.top );

View File

@ -292,8 +292,8 @@ copy_region( VipsRegion *from, VipsRegion *to, VipsRect *area )
/* Loop down common area, copying.
*/
for( y = area->top; y < VIPS_RECT_BOTTOM( area ); y++ ) {
PEL *p = (PEL *) VIPS_REGION_ADDR( from, area->left, y );
PEL *q = (PEL *) VIPS_REGION_ADDR( to, area->left, y );
VipsPel *p = VIPS_REGION_ADDR( from, area->left, y );
VipsPel *q = VIPS_REGION_ADDR( to, area->left, y );
memcpy( q, p, VIPS_IMAGE_SIZEOF_PEL( from->im ) * area->width );
}
@ -438,10 +438,13 @@ vips_tile_cache_init( VipsTileCache *cache )
* vips_tilecache:
* @in: input image
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @tile_width: width of tiles in cache
* @tile_height: height of tiles in cache
* @max_tiles: maximum number of tiles to cache
* @...: %NULL-terminated list of optional named arguments
*
* This operation behaves rather like vips_copy() between images
* @in and @out, except that it keeps a cache of computed pixels.

View File

@ -540,7 +540,7 @@ typedef struct {
REGION *ir; /* Input region */
int *offsets; /* Offsets for each non-zero matrix element */
PEL **pts; /* Per-non-zero mask element pointers */
VipsPel **pts; /* Per-non-zero mask element pointers */
int underflow; /* Underflow/overflow counts */
int overflow;
@ -602,7 +602,7 @@ conv_start( IMAGE *out, void *a, void *b )
*/
seq->ir = im_region_create( in );
seq->offsets = IM_ARRAY( out, conv->nnz, int );
seq->pts = IM_ARRAY( out, conv->nnz, PEL * );
seq->pts = IM_ARRAY( out, conv->nnz, VipsPel * );
if( !seq->ir || !seq->offsets || !seq->pts ) {
conv_stop( seq, in, conv );
return( NULL );
@ -726,7 +726,7 @@ conv_gen( REGION *or, void *vseq, void *a, void *b )
*/
for( z = 0; z < conv->nnz; z++ )
seq->pts[z] = seq->offsets[z] +
(PEL *) IM_REGION_ADDR( ir, le, y );
IM_REGION_ADDR( ir, le, y );
switch( in->BandFmt ) {
case IM_BANDFMT_UCHAR:
@ -965,8 +965,8 @@ convvec_gen( REGION *or, void *vseq, void *a, void *b )
printf( "before convolve: %d, %d\n", r->left, r->top + y );
for( v = 0; v < mask->ysize; v++ ) {
for( h = 0; h < mask->xsize; h++ )
printf( "%3d ", *((PEL *) IM_REGION_ADDR( ir,
r->left + h, r->top + y + v )) );
printf( "%3d ", *IM_REGION_ADDR( ir,
r->left + h, r->top + y + v ) );
printf( "\n" );
}
}
@ -996,7 +996,7 @@ convvec_gen( REGION *or, void *vseq, void *a, void *b )
#ifdef DEBUG_PIXELS
printf( "after clip: %d\n",
*((PEL *) IM_REGION_ADDR( or, r->left, r->top + y )) );
*IM_REGION_ADDR( or, r->left, r->top + y ) );
#endif /*DEBUG_PIXELS*/
}

View File

@ -154,7 +154,7 @@ typedef struct {
REGION *ir; /* Input region */
int *offsets; /* Offsets for each non-zero matrix element */
PEL **pts; /* Per-non-zero mask element image pointers */
VipsPel **pts; /* Per-non-zero mask element image pointers */
int last_bpl; /* Avoid recalcing offsets, if we can */
} ConvSequence;
@ -194,7 +194,7 @@ conv_start( IMAGE *out, void *a, void *b )
*/
seq->ir = im_region_create( in );
seq->offsets = IM_ARRAY( out, conv->nnz, int );
seq->pts = IM_ARRAY( out, conv->nnz, PEL * );
seq->pts = IM_ARRAY( out, conv->nnz, VipsPel * );
if( !seq->ir || !seq->offsets || !seq->pts ) {
conv_stop( seq, in, conv );
return( NULL );
@ -278,8 +278,8 @@ conv_gen( REGION *or, void *vseq, void *a, void *b )
/* Init pts for this line of PELs.
*/
for( z = 0; z < conv->nnz; z++ )
seq->pts[z] = seq->offsets[z] +
(PEL *) IM_REGION_ADDR( ir, le, y );
seq->pts[z] = seq->offsets[z] +
IM_REGION_ADDR( ir, le, y );
switch( in->BandFmt ) {
case IM_BANDFMT_UCHAR:

View File

@ -91,8 +91,8 @@ fastcor_gen( REGION *or, void *seq, void *a, void *b )
IM_REGION_ADDR( or, r->left, r->top + y );
for( x = 0; x < r->width; x++ ) {
PEL *b = (PEL *) ref->data;
PEL *a = (PEL *)
VipsPel *b = ref->data;
VipsPel *a =
IM_REGION_ADDR( ir, r->left + x, r->top + y );
int sum;

View File

@ -171,7 +171,7 @@ spcor_gen( REGION *or, void *vseq, void *a, void *b )
float *q = (float *) IM_REGION_ADDR( or, le, y );
for( x = le; x < ri; x++ ) {
PEL *p = (PEL *) IM_REGION_ADDR( ir, x, y );
VipsPel *p = IM_REGION_ADDR( ir, x, y );
/* Find sums for this position.
*/
@ -203,7 +203,7 @@ spcor_new( IMAGE *out, IMAGE *ref )
{
Spcor *spcor;
size_t sz = ref->Xsize * ref->Ysize;
PEL *p = (PEL *) ref->data;
VipsPel *p = ref->data;
double s;
size_t i;

View File

@ -81,7 +81,7 @@ IMAGE *im, *m;
int xpos, ypos, xsize, ysize; /* location of the box within im */
int dx, dy; /* displacements */
{
PEL *input, *cpinput;
VipsPel *input, *cpinput;
int *buf, *pnt, *cpnt;
double *line, *cpline;
int x, y;
@ -113,7 +113,7 @@ int dx, dy; /* displacements */
if ( (buf == NULL) || (line == NULL) ) {
im_error( "im_cooc_sym", "%s", _( "calloc failed") );
return(-1); }
input = (PEL*)im->data;
input = im->data;
input += ( ypos * im->Xsize + xpos );
offset = dy * im->Xsize + dx;
for ( y=0; y<ysize; y++ )
@ -141,7 +141,7 @@ int dx, dy; /* displacements */
cpline = line;
for (x=0; x<m->Xsize; x++)
*cpline++ = (double)(*cpnt++)/(double)norm;
if (im_writeline( y, m, (PEL *) line ) == -1)
if (im_writeline( y, m, (VipsPel *) line ) == -1)
{
im_error( "im_cooc_sym", "%s", _( "unable to im_writeline") );
return(-1);
@ -158,7 +158,7 @@ IMAGE *im, *m;
int xpos, ypos, xsize, ysize; /* location of the box within im */
int dx, dy; /* displacements */
{
PEL *input, *cpinput;
VipsPel *input, *cpinput;
int *buf, *pnt, *cpnt;
double *line, *cpline;
int x, y;
@ -190,7 +190,7 @@ int dx, dy; /* displacements */
if ( (buf == NULL) || (line == NULL) ) {
im_error( "im_cooc_ord", "%s", _( "calloc failed") );
return(-1); }
input = (PEL*)im->data;
input = im->data;
input += ( ypos * im->Xsize + xpos );
offset = dy * im->Xsize + dx;
for ( y=0; y<ysize; y++ )

View File

@ -23,29 +23,29 @@ libforeign_la_SOURCES = \
foreign.c \
matlab.h \
matlab.c \
matload.c
matload.c \
magick.h \
magick2vips.c \
magickload.c
magickload.c \
pngload.c \
pngsave.c \
vipspng.h \
vipspng.c
vipspng.c \
openexr2vips.h \
openexr2vips.c \
openexrload.c
openexrload.c \
fits.h \
fits.c \
fitsload.c \
fitssave.c
fitssave.c \
tiff.h \
vips2tiff.c \
tiff2vips.c \
tiffload.c \
tiffsave.c
tiffsave.c \
openslide2vips.h \
openslide2vips.c \
openslideload.c
openslideload.c \
vips2jpeg.c \
jpeg2vips.c \
jpeg.h \

View File

@ -309,7 +309,7 @@ read_csv( FILE *fp, VipsImage *out,
buf[x] = d;
}
if( vips_image_write_line( out, y, (PEL *) buf ) )
if( vips_image_write_line( out, y, (VipsPel *) buf ) )
return( -1 );
/* Skip over the '\n' to the next line.
@ -368,9 +368,9 @@ vips2csv( VipsImage *in, FILE *fp, const char *sep )
int es = VIPS_IMAGE_SIZEOF_ELEMENT( in );
int x, y;
PEL *p;
VipsPel *p;
p = (PEL *) in->data;
p = in->data;
for( y = 0; y < in->Ysize; y++ ) {
for( x = 0; x < w; x++ ) {
if( x > 0 )

View File

@ -176,11 +176,14 @@ vips_foreign_load_csv_init( VipsForeignLoadCsv *csv )
* vips_csvload:
* @filename: file to load
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @skip: skip this many lines at start of file
* @lines: read this many lines from file
* @whitespace: set of whitespace characters
* @separator: set of separator characters
* @...: %NULL-terminated list of optional named arguments
*
* Load a CSV (comma-separated values) file. The output image is always 1
* band (monochrome), #VIPS_FORMAT_DOUBLE.

View File

@ -142,9 +142,12 @@ vips_foreign_save_csv_init( VipsForeignSaveCsv *csv )
* vips_csvsave:
* @in: image to save
* @filename: file to write to
* @separator: separator string
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @separator: separator string
*
* Writes the pixels in @in to the @filename as CSV (comma-separated values).
* The image is written
* one line of text per scanline. Complex numbers are written as

View File

@ -113,7 +113,7 @@ typedef struct {
/* We split bands up for write into this buffer.
*/
PEL *buffer;
VipsPel *buffer;
} VipsFits;
const char *vips__fits_suffs[] = { ".fits", NULL };
@ -349,7 +349,7 @@ fits2vips_generate( VipsRegion *out,
VipsFits *fits = (VipsFits *) a;
Rect *r = &out->valid;
PEL *q;
VipsPel *q;
int z;
int status;
@ -384,7 +384,7 @@ fits2vips_generate( VipsRegion *out,
for( z = 0; z < MAX_DIMENSIONS; z++ )
inc[z] = 1;
q = (PEL *) VIPS_REGION_ADDR( out, r->left, r->top );
q = VIPS_REGION_ADDR( out, r->left, r->top );
/* Break on ffgsv() for this call.
*/
@ -417,7 +417,7 @@ fits2vips_generate( VipsRegion *out,
for( z = 0; z < MAX_DIMENSIONS; z++ )
inc[z] = 1;
q = (PEL *) VIPS_REGION_ADDR( out, r->left, y );
q = VIPS_REGION_ADDR( out, r->left, y );
/* Break on ffgsv() for this call.
*/
@ -562,7 +562,7 @@ vips_fits_new_write( VipsImage *in, const char *filename )
/* We need to be able to hold one scanline of one band.
*/
if( !(fits->buffer = VIPS_ARRAY( NULL,
VIPS_IMAGE_SIZEOF_ELEMENT( in ) * in->Xsize, PEL )) )
VIPS_IMAGE_SIZEOF_ELEMENT( in ) * in->Xsize, VipsPel )) )
return( NULL );
/* fits_create_file() will fail if there's a file of thet name, unless
@ -682,11 +682,11 @@ vips_fits_write( VipsRegion *region, VipsRect *area, void *a )
*/
for( y = 0; y < area->height; y++ ) {
PEL *p = (PEL *) VIPS_REGION_ADDR( region,
VipsPel *p = VIPS_REGION_ADDR( region,
area->left, area->top + y );
for( b = 0; b < image->Bands; b++ ) {
PEL *p1, *q;
VipsPel *p1, *q;
long fpixel[3];
p1 = p + b * es;

View File

@ -1450,9 +1450,12 @@ vips_magickload( const char *filename, VipsImage **out, ... )
* vips_tiffload:
* @filename: file to load
* @out: decompressed image
* @page: load this page
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @page: load this page
*
* Read a TIFF file into a VIPS image. It is a full baseline TIFF 6 reader,
* with extensions for tiled images, multipage images, LAB colour space,
* pyramidal images and JPEG compression. including CMYK and YCbCr.
@ -1483,6 +1486,10 @@ vips_tiffload( const char *filename, VipsImage **out, ... )
* vips_tiffsave:
* @in: image to save
* @filename: file to write to
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @compression; use this compression scheme
* @Q: quality factor
* @predictor; compress with this prediction
@ -1496,7 +1503,6 @@ vips_tiffload( const char *filename, VipsImage **out, ... )
* @xres; horizontal resolution
* @yres; vertical resolution
* @bigtiff; write a BigTiff file
* @...: %NULL-terminated list of optional named arguments
*
* Write a VIPS image to a file as TIFF.
*
@ -1611,10 +1617,12 @@ vips_jpegload_buffer( void *buf, size_t len, VipsImage **out, ... )
* vips_jpegload:
* @filename: file to load
* @out: decompressed image
* @flags: image flags
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @shrink: shrink by this much on load
* @fail: fail on warnings
* @...: %NULL-terminated list of optional named arguments
*
* Read a JPEG file into a VIPS image. It can read most 8-bit JPEG images,
* including CMYK and YCbCr.
@ -1673,9 +1681,12 @@ vips_jpegload( const char *filename, VipsImage **out, ... )
/**
* vips_jpegsave_mime:
* @in: image to save
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @Q: JPEG quality factor
* @profile: attach this ICC profile
* @...: %NULL-terminated list of optional named arguments
*
* As vips_jpegsave(), but save as a mime jpeg on stdout.
*
@ -1701,9 +1712,12 @@ vips_jpegsave_mime( VipsImage *in, ... )
* @in: image to save
* @buf: return output buffer here
* @len: return output length here
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @Q: JPEG quality factor
* @profile: attach this ICC profile
* @...: %NULL-terminated list of optional named arguments
*
* As vips_jpegsave(), but save to a memory buffer.
*
@ -1742,9 +1756,12 @@ vips_jpegsave_buffer( VipsImage *in, void **buf, size_t *len, ... )
* vips_jpegsave:
* @in: image to save
* @filename: file to write to
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @Q: quality factor
* @profile: attach this ICC profile
* @...: %NULL-terminated list of optional named arguments
*
* Write a VIPS image to a file as JPEG.
*
@ -1815,9 +1832,12 @@ vips_openexrload( const char *filename, VipsImage **out, ... )
* vips_openslideload:
* @filename: file to load
* @out: decompressed image
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @layer: load this layer
* @associated: load this associated image
* @...: %NULL-terminated list of optional named arguments
*
* Read a virtual slide supported by the OpenSlide library into a VIPS image.
* OpenSlide supports images in Aperio, Hamamatsu VMS, Hamamatsu VMU, MIRAX,
@ -1938,9 +1958,12 @@ vips_pngload( const char *filename, VipsImage **out, ... )
* vips_pngsave:
* @in: image to save
* @filename: file to write to
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @compression: compression level
* @interlace: interlace image
* @...: %NULL-terminated list of optional named arguments
*
* Write a VIPS image to a file as PNG.
*
@ -1979,9 +2002,12 @@ vips_pngsave( VipsImage *in, const char *filename, ... )
* @in: image to save
* @buf: return output buffer here
* @len: return output length here
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @compression: compression level
* @interlace: interlace image
* @...: %NULL-terminated list of optional named arguments
*
* As vips_pngsave(), but save to a memory buffer.
*

View File

@ -477,7 +477,7 @@ parse_header( Read *read )
}
static void
unpack_pixels( VipsImage *im, PEL *q8, PixelPacket *pixels, int n )
unpack_pixels( VipsImage *im, VipsPel *q8, PixelPacket *pixels, int n )
{
int x;

View File

@ -223,7 +223,7 @@ static int
mat2vips_get_data( mat_t *mat, matvar_t *var, VipsImage *im )
{
int y;
PEL *buffer;
VipsPel *buffer;
const int es = VIPS_IMAGE_SIZEOF_ELEMENT( im );
/* Matlab images are plane-separate, so we have to assemble bands in
@ -240,20 +240,21 @@ mat2vips_get_data( mat_t *mat, matvar_t *var, VipsImage *im )
/* Matlab images are in columns, so we have to transpose into
* scanlines with this buffer.
*/
if( !(buffer = VIPS_ARRAY( im, VIPS_IMAGE_SIZEOF_LINE( im ), PEL )) )
if( !(buffer = VIPS_ARRAY( im,
VIPS_IMAGE_SIZEOF_LINE( im ), VipsPel )) )
return( -1 );
for( y = 0; y < im->Ysize; y++ ) {
const PEL *p = var->data + y * es;
const VipsPel *p = var->data + y * es;
int x;
PEL *q;
VipsPel *q;
q = buffer;
for( x = 0; x < im->Xsize; x++ ) {
int b;
for( b = 0; b < im->Bands; b++ ) {
const PEL *p2 = p + b * is;
const VipsPel *p2 = p + b * is;
int z;
for( z = 0; z < es; z++ )

View File

@ -399,7 +399,7 @@ vips__openexr_read( const char *filename, VipsImage *out )
(ImfHalf *) imf_buffer, vips_buffer );
if( vips_image_write_line( out, y,
(PEL *) vips_buffer ) )
(VipsPel *) vips_buffer ) )
return( -1 );
}
}

View File

@ -305,9 +305,9 @@ static int
read_ascii( FILE *fp, VipsImage *out )
{
int x, y;
PEL *buf;
VipsPel *buf;
if( !(buf = VIPS_ARRAY( out, VIPS_IMAGE_SIZEOF_LINE( out ), PEL )) )
if( !(buf = VIPS_ARRAY( out, VIPS_IMAGE_SIZEOF_LINE( out ), VipsPel )) )
return( -1 );
for( y = 0; y < out->Ysize; y++ ) {
@ -349,9 +349,9 @@ static int
read_1bit_ascii( FILE *fp, VipsImage *out )
{
int x, y;
PEL *buf;
VipsPel *buf;
if( !(buf = VIPS_ARRAY( out, VIPS_IMAGE_SIZEOF_LINE( out ), PEL )) )
if( !(buf = VIPS_ARRAY( out, VIPS_IMAGE_SIZEOF_LINE( out ), VipsPel )) )
return( -1 );
for( y = 0; y < out->Ysize; y++ ) {
@ -381,9 +381,9 @@ read_1bit_binary( FILE *fp, VipsImage *out )
{
int x, y, i;
int bits;
PEL *buf;
VipsPel *buf;
if( !(buf = VIPS_ARRAY( out, VIPS_IMAGE_SIZEOF_LINE( out ), PEL )) )
if( !(buf = VIPS_ARRAY( out, VIPS_IMAGE_SIZEOF_LINE( out ), VipsPel )) )
return( -1 );
bits = fgetc( fp );
@ -493,7 +493,7 @@ vips__ppm_load( const char *filename, VipsImage *out )
int
vips__ppm_isppm( const char *filename )
{
PEL buf[3];
VipsPel buf[3];
if( vips__get_bytes( filename, buf, 2 ) ) {
int i;
@ -523,7 +523,7 @@ vips__ppm_flags( const char *filename )
const char *vips__ppm_suffs[] = { ".ppm", ".pgm", ".pbm", ".pfm", NULL };
typedef int (*write_fn)( VipsImage *in, FILE *fp, PEL *p );
typedef int (*write_fn)( VipsImage *in, FILE *fp, VipsPel *p );
/* What we track during a PPM write.
*/
@ -564,7 +564,7 @@ write_new( VipsImage *in, const char *name )
}
static int
write_ppm_line_ascii( VipsImage *in, FILE *fp, PEL *p )
write_ppm_line_ascii( VipsImage *in, FILE *fp, VipsPel *p )
{
const int sk = VIPS_IMAGE_SIZEOF_PEL( in );
int x, k;
@ -604,7 +604,7 @@ write_ppm_line_ascii( VipsImage *in, FILE *fp, PEL *p )
}
static int
write_ppm_line_binary( VipsImage *in, FILE *fp, PEL *p )
write_ppm_line_binary( VipsImage *in, FILE *fp, VipsPel *p )
{
if( !fwrite( p, VIPS_IMAGE_SIZEOF_LINE( in ), 1, fp ) ) {
vips_error( "vips2ppm",
@ -622,7 +622,7 @@ write_ppm_block( REGION *region, Rect *area, void *a )
int i;
for( i = 0; i < area->height; i++ ) {
PEL *p = (PEL *) VIPS_REGION_ADDR( region, 0, area->top + i );
VipsPel *p = VIPS_REGION_ADDR( region, 0, area->top + i );
if( write->fn( write->in, write->fp, p ) )
return( -1 );

View File

@ -138,9 +138,12 @@ vips_foreign_save_ppm_init( VipsForeignSavePpm *ppm )
* vips_ppmsave:
* @in: image to save
* @filename: file to write to
* @ascii: save as ASCII rather than binary
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @ascii: save as ASCII rather than binary
*
* Write a VIPS image to a file as PPM. It can write 8, 16 or
* 32 bit unsigned integer images, float images, colour or monochrome,
* stored as binary or ASCII.

View File

@ -1098,7 +1098,7 @@ vips2rad_put_data_block( VipsRegion *region, Rect *area, void *a )
int i;
for( i = 0; i < area->height; i++ ) {
PEL *p = (PEL *) VIPS_REGION_ADDR( region, 0, area->top + i );
VipsPel *p = VIPS_REGION_ADDR( region, 0, area->top + i );
if( fwritecolrs( p, area->width, write->fout ) )
return( -1 );

View File

@ -157,11 +157,14 @@ vips_foreign_load_raw_init( VipsForeignLoadRaw *raw )
* vips_rawload:
* @filename: file to load
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @width: width of image in pixels
* @height: height of image in pixels
* @bands: number of image bands
* @offset: offset in bytes from start of file
* @...: %NULL-terminated list of optional named arguments
*
* This operation mmaps the file, setting @out so that access to that
* image will read from the file.

View File

@ -94,7 +94,8 @@ vips_foreign_save_raw_write( VipsRegion *region, Rect *area, void *a )
int i;
for( i = 0; i < area->height; i++ ) {
PEL *p = VIPS_REGION_ADDR( region, area->left, area->top + i );
VipsPel *p =
VIPS_REGION_ADDR( region, area->left, area->top + i );
if( vips__write( raw->fd, p,
VIPS_IMAGE_SIZEOF_PEL( save->in ) * area->width ) )
@ -222,7 +223,8 @@ vips_foreign_save_raw_fd_write( VipsRegion *region, Rect *area, void *a )
int i;
for( i = 0; i < area->height; i++ ) {
PEL *p = VIPS_REGION_ADDR( region, area->left, area->top + i );
VipsPel *p =
VIPS_REGION_ADDR( region, area->left, area->top + i );
if( vips__write( fd->fd, p,
VIPS_IMAGE_SIZEOF_PEL( save->in ) * area->width ) )

View File

@ -178,7 +178,8 @@
/* Scanline-type process function.
*/
typedef void (*scanline_process_fn)( PEL *q, PEL *p, int n, void *client );
typedef void (*scanline_process_fn)( VipsPel *q, VipsPel *p, int n,
void *client );
/* Stuff we track during a read.
*/
@ -326,7 +327,7 @@ tfget16( TIFF *tif, ttag_t tag, int *out )
/* Per-scanline process function for VIPS_CODING_LABQ.
*/
static void
labpack_line( PEL *q, PEL *p, int n, void *dummy )
labpack_line( VipsPel *q, VipsPel *p, int n, void *dummy )
{
int x;
@ -363,7 +364,7 @@ parse_labpack( ReadTiff *rtiff, VipsImage *out )
/* Per-scanline process function for VIPS_CODING_LABQ.
*/
static void
labs_line( PEL *q, PEL *p, int n, void *dummy )
labs_line( VipsPel *q, VipsPel *p, int n, void *dummy )
{
int x;
unsigned short *p1 = (unsigned short *) p;
@ -401,13 +402,13 @@ parse_labs( ReadTiff *rtiff, VipsImage *out )
/* Per-scanline process function for 1 bit images.
*/
static void
onebit_line( PEL *q, PEL *p, int n, void *flg )
onebit_line( VipsPel *q, VipsPel *p, int n, void *flg )
{
/* Extract PHOTOMETRIC_INTERPRETATION.
*/
int pm = *((int *) flg);
int x, i, z;
PEL bits;
VipsPel bits;
int black = (pm == PHOTOMETRIC_MINISBLACK) ? 0 : 255;
int white = black ^ -1;
@ -415,7 +416,7 @@ onebit_line( PEL *q, PEL *p, int n, void *flg )
/* (sigh) how many times have I written this?
*/
for( x = 0, i = 0; i < (n >> 3); i++ ) {
bits = (PEL) p[i];
bits = (VipsPel) p[i];
for( z = 0; z < 8; z++, x++ ) {
q[x] = (bits & 128) ? white : black;
@ -465,11 +466,11 @@ parse_onebit( ReadTiff *rtiff, int pm, VipsImage *out )
/* Per-scanline process function for 8-bit greyscale images.
*/
static void
greyscale8_line( PEL *q, PEL *p, int n, void *flg )
greyscale8_line( VipsPel *q, VipsPel *p, int n, void *flg )
{
/* Extract swap mask.
*/
PEL mask = *((PEL *) flg);
VipsPel mask = *((VipsPel *) flg);
int x;
/* Read bytes, swapping sense if necessary.
@ -483,7 +484,7 @@ greyscale8_line( PEL *q, PEL *p, int n, void *flg )
static int
parse_greyscale8( ReadTiff *rtiff, int pm, VipsImage *out )
{
PEL *mask;
VipsPel *mask;
if( !tfequals( rtiff->tiff, TIFFTAG_SAMPLESPERPIXEL, 1 ) ||
!tfequals( rtiff->tiff, TIFFTAG_BITSPERSAMPLE, 8 ) )
@ -491,7 +492,7 @@ parse_greyscale8( ReadTiff *rtiff, int pm, VipsImage *out )
/* Eor each pel with this later.
*/
if( !(mask = VIPS_ARRAY( out, 1, PEL )) )
if( !(mask = VIPS_ARRAY( out, 1, VipsPel )) )
return( -1 );
*mask = (pm == PHOTOMETRIC_MINISBLACK) ? 0 : 255;
@ -509,7 +510,7 @@ parse_greyscale8( ReadTiff *rtiff, int pm, VipsImage *out )
/* Per-scanline process function for 16-bit greyscale images.
*/
static void
greyscale16_line( PEL *q, PEL *p, int n, void *flg )
greyscale16_line( VipsPel *q, VipsPel *p, int n, void *flg )
{
/* Extract swap mask.
*/
@ -555,7 +556,7 @@ parse_greyscale16( ReadTiff *rtiff, int pm, VipsImage *out )
/* Per-scanline process function when we just need to copy.
*/
static void
memcpy_line( PEL *q, PEL *p, int n, void *client )
memcpy_line( VipsPel *q, VipsPel *p, int n, void *client )
{
VipsImage *im = (VipsImage *) client;
@ -587,9 +588,9 @@ parse_greyscale32f( ReadTiff *rtiff, int pm, VipsImage *out )
typedef struct {
/* LUTs mapping image indexes to RGB.
*/
PEL *red;
PEL *green;
PEL *blue;
VipsPel *red;
VipsPel *green;
VipsPel *blue;
/* Bits per sample.
*/
@ -603,12 +604,12 @@ typedef struct {
/* Per-scanline process function for palette images.
*/
static void
palette_line( PEL *q, PEL *p, int n, void *flg )
palette_line( VipsPel *q, VipsPel *p, int n, void *flg )
{
PaletteRead *read = (PaletteRead *) flg;
int bit;
PEL data;
VipsPel data;
int x;
bit = 0;
@ -648,9 +649,9 @@ parse_palette( ReadTiff *rtiff, VipsImage *out )
int i;
if( !(read = VIPS_NEW( out, PaletteRead )) ||
!(read->red = VIPS_ARRAY( out, 256, PEL )) ||
!(read->green = VIPS_ARRAY( out, 256, PEL )) ||
!(read->blue = VIPS_ARRAY( out, 256, PEL )) )
!(read->red = VIPS_ARRAY( out, 256, VipsPel )) ||
!(read->green = VIPS_ARRAY( out, 256, VipsPel )) ||
!(read->blue = VIPS_ARRAY( out, 256, VipsPel )) )
return( -1 );
if( !tfequals( rtiff->tiff, TIFFTAG_SAMPLESPERPIXEL, 1 ) ||
@ -1225,10 +1226,10 @@ tiff_fill_region( VipsRegion *out, void *seq, void *a, void *b, gboolean *stop )
* Just unpack the section of the tile we need.
*/
for( z = 0; z < hit.height; z++ ) {
PEL *p = (PEL *) buf +
VipsPel *p = (VipsPel *) buf +
(hit.left - tile.left) * tps +
(hit.top - tile.top + z) * tls;
PEL *q = (PEL *) VIPS_REGION_ADDR( out,
VipsPel *q = VIPS_REGION_ADDR( out,
hit.left, hit.top + z );
rtiff->sfn( q, p, hit.width, rtiff->client );
@ -1312,13 +1313,13 @@ read_stripwise( ReadTiff *rtiff, VipsImage *out )
tsize_t strip_size;
int number_of_strips;
PEL *vbuf;
VipsPel *vbuf;
tdata_t tbuf;
tstrip_t strip;
tsize_t length;
int y;
int i;
PEL *p;
VipsPel *p;
#ifdef DEBUG
printf( "tiff2vips: read_stripwise\n" );
@ -1342,7 +1343,8 @@ read_stripwise( ReadTiff *rtiff, VipsImage *out )
/* Make buffers.
*/
if( !(vbuf = VIPS_ARRAY( out, VIPS_IMAGE_SIZEOF_LINE( out ), PEL )) ||
if( !(vbuf = VIPS_ARRAY( out,
VIPS_IMAGE_SIZEOF_LINE( out ), VipsPel )) ||
!(tbuf = vips_malloc( VIPS_OBJECT( out ), strip_size )) )
return( -1 );

View File

@ -182,7 +182,7 @@
/* Max no of tiles we buffer in a layer. Enough to buffer a line of 64x64
* tiles on a 100k pixel across image.
*/
#define IM_MAX_LAYER_BUFFER (1000)
#define MAX_LAYER_BUFFER (1000)
/* Bits we OR together for quadrants in a tile.
*/
@ -198,7 +198,7 @@ typedef enum pyramid_bits {
/* A tile in our pyramid.
*/
typedef struct pyramid_tile {
REGION *tile;
VipsRegion *tile;
PyramidBits bits;
} PyramidTile;
@ -213,8 +213,8 @@ typedef struct pyramid_layer {
char *lname; /* Name of this TIFF file */
TIFF *tif; /* TIFF file we write this layer to */
PEL *tbuf; /* TIFF output buffer */
PyramidTile tiles[IM_MAX_LAYER_BUFFER];
VipsPel *tbuf; /* TIFF output buffer */
PyramidTile tiles[MAX_LAYER_BUFFER];
struct pyramid_layer *below; /* Tiles go to here */
struct pyramid_layer *above; /* Tiles come from here */
@ -223,18 +223,18 @@ typedef struct pyramid_layer {
/* A TIFF image in the process of being written.
*/
typedef struct tiff_write {
IMAGE *im; /* Original input image */
VipsImage *im; /* Original input image */
char *name; /* Final name we write to */
/* Read from im with these.
*/
REGION *reg;
VipsRegion *reg;
char *bname; /* Name for base layer */
TIFF *tif; /* Image we write to */
PyramidLayer *layer; /* Top of pyramid, if in use */
PEL *tbuf; /* TIFF output buffer */
VipsPel *tbuf; /* TIFF output buffer */
int tls; /* Tile line size */
int compression; /* Compression type */
@ -266,7 +266,7 @@ tiff_openout( TiffWrite *tw, const char *name )
#endif /*DEBUG*/
if( !(tif = TIFFOpen( name, mode )) ) {
im_error( "vips2tiff",
vips_error( "vips2tiff",
_( "unable to open \"%s\" for output" ), name );
return( NULL );
}
@ -282,7 +282,7 @@ tiff_openin( const char *name )
TIFF *tif;
if( !(tif = TIFFOpen( name, "r" )) ) {
im_error( "vips2tiff",
vips_error( "vips2tiff",
_( "unable to open \"%s\" for input" ), name );
return( NULL );
}
@ -293,7 +293,7 @@ tiff_openin( const char *name )
/* Convert VIPS LabQ to TIFF LAB. Just take the first three bands.
*/
static void
LabQ2LabC( PEL *q, PEL *p, int n )
LabQ2LabC( VipsPel *q, VipsPel *p, int n )
{
int x;
@ -312,10 +312,10 @@ LabQ2LabC( PEL *q, PEL *p, int n )
/* Pack 8 bit VIPS to 1 bit TIFF.
*/
static void
eightbit2onebit( PEL *q, PEL *p, int n )
eightbit2onebit( VipsPel *q, VipsPel *p, int n )
{
int x;
PEL bits;
VipsPel bits;
bits = 0;
for( x = 0; x < n; x++ ) {
@ -338,7 +338,7 @@ eightbit2onebit( PEL *q, PEL *p, int n )
/* Convert VIPS LABS to TIFF 16 bit LAB.
*/
static void
LabS2Lab16( PEL *q, PEL *p, int n )
LabS2Lab16( VipsPel *q, VipsPel *p, int n )
{
int x;
short *p1 = (short *) p;
@ -359,23 +359,23 @@ LabS2Lab16( PEL *q, PEL *p, int n )
/* Pack a VIPS region into a TIFF tile buffer.
*/
static void
pack2tiff( TiffWrite *tw, REGION *in, PEL *q, Rect *area )
pack2tiff( TiffWrite *tw, VipsRegion *in, VipsPel *q, VipsRect *area )
{
int y;
for( y = area->top; y < IM_RECT_BOTTOM( area ); y++ ) {
PEL *p = (PEL *) IM_REGION_ADDR( in, area->left, y );
for( y = area->top; y < VIPS_RECT_BOTTOM( area ); y++ ) {
VipsPel *p = (VipsPel *) VIPS_REGION_ADDR( in, area->left, y );
if( in->im->Coding == IM_CODING_LABQ )
if( in->im->Coding == VIPS_CODING_LABQ )
LabQ2LabC( q, p, area->width );
else if( tw->onebit )
eightbit2onebit( q, p, area->width );
else if( in->im->BandFmt == IM_BANDFMT_SHORT &&
in->im->Type == IM_TYPE_LABS )
else if( in->im->BandFmt == VIPS_FORMAT_SHORT &&
in->im->Type == VIPS_INTERPRETATION_LABS )
LabS2Lab16( q, p, area->width );
else
memcpy( q, p,
area->width * IM_IMAGE_SIZEOF_PEL( in->im ) );
area->width * VIPS_IMAGE_SIZEOF_PEL( in->im ) );
q += tw->tls;
}
@ -389,10 +389,10 @@ embed_profile_file( TIFF *tif, const char *profile )
char *buffer;
unsigned int length;
if( !(buffer = im__file_read_name( profile, VIPS_ICC_DIR, &length )) )
if( !(buffer = vips__file_read_name( profile, VIPS_ICC_DIR, &length )) )
return( -1 );
TIFFSetField( tif, TIFFTAG_ICCPROFILE, length, buffer );
im_free( buffer );
vips_free( buffer );
#ifdef DEBUG
printf( "vips2tiff: attached profile \"%s\"\n", profile );
@ -401,15 +401,15 @@ embed_profile_file( TIFF *tif, const char *profile )
return( 0 );
}
/* Embed an ICC profile from IMAGE metadata.
/* Embed an ICC profile from VipsImage metadata.
*/
static int
embed_profile_meta( TIFF *tif, IMAGE *im )
embed_profile_meta( TIFF *tif, VipsImage *im )
{
void *data;
size_t data_length;
if( im_meta_get_blob( im, IM_META_ICC_NAME, &data, &data_length ) )
if( vips_image_get_blob( im, VIPS_META_ICC_NAME, &data, &data_length ) )
return( -1 );
TIFFSetField( tif, TIFFTAG_ICCPROFILE, data_length, data );
@ -429,14 +429,14 @@ embed_profile( TiffWrite *tw, TIFF *tif )
return( -1 );
if( !tw->icc_profile &&
im_header_get_typeof( tw->im, IM_META_ICC_NAME ) &&
vips_image_get_typeof( tw->im, VIPS_META_ICC_NAME ) &&
embed_profile_meta( tif, tw->im ) )
return( -1 );
return( 0 );
}
/* Write a TIFF header. width and height are the size of the IMAGE we are
/* Write a TIFF header. width and height are the size of the VipsImage we are
* writing (may have been shrunk!).
*/
static int
@ -468,9 +468,9 @@ write_tiff_header( TiffWrite *tw, TIFF *tif, int width, int height )
*/
TIFFSetField( tif, TIFFTAG_RESOLUTIONUNIT, tw->resunit );
TIFFSetField( tif, TIFFTAG_XRESOLUTION,
IM_CLIP( 0.01, tw->xres, 10000 ) );
VIPS_CLIP( 0.01, tw->xres, 10000 ) );
TIFFSetField( tif, TIFFTAG_YRESOLUTION,
IM_CLIP( 0.01, tw->yres, 10000 ) );
VIPS_CLIP( 0.01, tw->yres, 10000 ) );
/* Attach ICC profile.
*/
@ -479,7 +479,7 @@ write_tiff_header( TiffWrite *tw, TIFF *tif, int width, int height )
/* And colour fields.
*/
if( tw->im->Coding == IM_CODING_LABQ ) {
if( tw->im->Coding == VIPS_CODING_LABQ ) {
TIFFSetField( tif, TIFFTAG_SAMPLESPERPIXEL, 3 );
TIFFSetField( tif, TIFFTAG_BITSPERSAMPLE, 8 );
TIFFSetField( tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_CIELAB );
@ -495,7 +495,7 @@ write_tiff_header( TiffWrite *tw, TIFF *tif, int width, int height )
TIFFSetField( tif, TIFFTAG_SAMPLESPERPIXEL, tw->im->Bands );
TIFFSetField( tif, TIFFTAG_BITSPERSAMPLE,
im_bits_of_fmt( tw->im->BandFmt ) );
vips_format_sizeof( tw->im->BandFmt ) << 3 );
switch( tw->im->Bands ) {
case 1:
@ -509,10 +509,10 @@ write_tiff_header( TiffWrite *tw, TIFF *tif, int width, int height )
case 3:
case 4:
if( tw->im->Type == IM_TYPE_LAB ||
tw->im->Type == IM_TYPE_LABS )
if( tw->im->Type == VIPS_INTERPRETATION_LAB ||
tw->im->Type == VIPS_INTERPRETATION_LABS )
photometric = PHOTOMETRIC_CIELAB;
else if( tw->im->Type == IM_TYPE_CMYK ) {
else if( tw->im->Type == VIPS_INTERPRETATION_CMYK ) {
photometric = PHOTOMETRIC_SEPARATED;
TIFFSetField( tif,
TIFFTAG_INKSET, INKSET_CMYK );
@ -527,7 +527,7 @@ write_tiff_header( TiffWrite *tw, TIFF *tif, int width, int height )
else
photometric = PHOTOMETRIC_RGB;
if( tw->im->Type != IM_TYPE_CMYK &&
if( tw->im->Type != VIPS_INTERPRETATION_CMYK &&
tw->im->Bands == 4 ) {
v[0] = EXTRASAMPLE_ASSOCALPHA;
TIFFSetField( tif, TIFFTAG_EXTRASAMPLES, 1, v );
@ -535,7 +535,7 @@ write_tiff_header( TiffWrite *tw, TIFF *tif, int width, int height )
break;
case 5:
if( tw->im->Type == IM_TYPE_CMYK ) {
if( tw->im->Type == VIPS_INTERPRETATION_CMYK ) {
photometric = PHOTOMETRIC_SEPARATED;
TIFFSetField( tif,
TIFFTAG_INKSET, INKSET_CMYK );
@ -565,7 +565,7 @@ write_tiff_header( TiffWrite *tw, TIFF *tif, int width, int height )
/* Sample format ... for float, we write IEEE.
*/
if( tw->im->BandFmt == IM_BANDFMT_FLOAT )
if( tw->im->BandFmt == VIPS_FORMAT_FLOAT )
TIFFSetField( tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP );
return( 0 );
@ -578,16 +578,13 @@ free_layer( PyramidLayer *layer )
{
int i;
for( i = 0; i < IM_MAX_LAYER_BUFFER; i++ )
if( layer->tiles[i].tile ) {
im_region_free( layer->tiles[i].tile );
layer->tiles[i].tile = NULL;
}
for( i = 0; i < MAX_LAYER_BUFFER; i++ )
VIPS_FREEF( g_object_unref, layer->tiles[i].tile );
/* And close the TIFF file we are writing to.
*/
IM_FREEF( im_free, layer->tbuf );
IM_FREEF( TIFFClose, layer->tif );
VIPS_FREEF( vips_free, layer->tbuf );
VIPS_FREEF( TIFFClose, layer->tif );
}
/* Free an entire pyramid.
@ -608,7 +605,7 @@ static int
build_pyramid( TiffWrite *tw, PyramidLayer *above,
PyramidLayer **zap, int w, int h )
{
PyramidLayer *layer = IM_NEW( tw->im, PyramidLayer );
PyramidLayer *layer = VIPS_NEW( tw->im, PyramidLayer );
int i;
if( !layer )
@ -628,7 +625,7 @@ build_pyramid( TiffWrite *tw, PyramidLayer *above,
layer->tif = NULL;
layer->tbuf = NULL;
for( i = 0; i < IM_MAX_LAYER_BUFFER; i++ ) {
for( i = 0; i < MAX_LAYER_BUFFER; i++ ) {
layer->tiles[i].tile = NULL;
layer->tiles[i].bits = PYR_NONE;
}
@ -645,7 +642,7 @@ build_pyramid( TiffWrite *tw, PyramidLayer *above,
&layer->below, layer->width, layer->height ) )
return( -1 );
if( !(layer->lname = im__temp_name( "%s.tif" )) )
if( !(layer->lname = vips__temp_name( "%s.tif" )) )
return( -1 );
/* Make output image.
@ -658,7 +655,7 @@ build_pyramid( TiffWrite *tw, PyramidLayer *above,
if( write_tiff_header( tw, layer->tif, layer->width, layer->height ) )
return( -1 );
if( !(layer->tbuf = im_malloc( NULL, TIFFTileSize( layer->tif ) )) )
if( !(layer->tbuf = vips_malloc( NULL, TIFFTileSize( layer->tif ) )) )
return( -1 );
return( 0 );
@ -674,24 +671,24 @@ find_new_tile( PyramidLayer *layer )
/* Exisiting buffer we have finished with?
*/
for( i = 0; i < IM_MAX_LAYER_BUFFER; i++ )
for( i = 0; i < MAX_LAYER_BUFFER; i++ )
if( layer->tiles[i].bits == PYR_ALL )
return( i );
/* Have to make a new one.
*/
for( i = 0; i < IM_MAX_LAYER_BUFFER; i++ )
for( i = 0; i < MAX_LAYER_BUFFER; i++ )
if( !layer->tiles[i].tile ) {
if( !(layer->tiles[i].tile =
im_region_create( layer->tw->im )) )
vips_region_new( layer->tw->im )) )
return( -1 );
im__region_no_ownership( layer->tiles[i].tile );
vips__region_no_ownership( layer->tiles[i].tile );
return( i );
}
/* Out of space!
*/
im_error( "vips2tiff",
vips_error( "vips2tiff",
"%s", _( "layer buffer exhausted -- "
"try making TIFF output tiles smaller" ) );
@ -701,17 +698,17 @@ find_new_tile( PyramidLayer *layer )
/* Find a tile in the layer buffer - if it's not there, make a new one.
*/
static int
find_tile( PyramidLayer *layer, Rect *pos )
find_tile( PyramidLayer *layer, VipsRect *pos )
{
int i;
Rect quad;
Rect image;
Rect inter;
VipsRect quad;
VipsRect image;
VipsRect inter;
/* Do we have a REGION for this position?
/* Do we have a VipsRegion for this position?
*/
for( i = 0; i < IM_MAX_LAYER_BUFFER; i++ ) {
REGION *reg = layer->tiles[i].tile;
for( i = 0; i < MAX_LAYER_BUFFER; i++ ) {
VipsRegion *reg = layer->tiles[i].tile;
if( reg && reg->valid.left == pos->left &&
reg->valid.top == pos->top )
@ -722,7 +719,7 @@ find_tile( PyramidLayer *layer, Rect *pos )
*/
if( (i = find_new_tile( layer )) < 0 )
return( -1 );
if( im_region_buffer( layer->tiles[i].tile, pos ) )
if( vips_region_buffer( layer->tiles[i].tile, pos ) )
return( -1 );
layer->tiles[i].bits = PYR_NONE;
@ -738,43 +735,43 @@ find_tile( PyramidLayer *layer, Rect *pos )
quad.left = pos->left;
quad.top = pos->top;
im_rect_intersectrect( &quad, &image, &inter );
if( im_rect_isempty( &inter ) )
vips_rect_intersectrect( &quad, &image, &inter );
if( vips_rect_isempty( &inter ) )
layer->tiles[i].bits |= PYR_TL;
quad.left = pos->left + quad.width;
quad.top = pos->top;
im_rect_intersectrect( &quad, &image, &inter );
if( im_rect_isempty( &inter ) )
vips_rect_intersectrect( &quad, &image, &inter );
if( vips_rect_isempty( &inter ) )
layer->tiles[i].bits |= PYR_TR;
quad.left = pos->left;
quad.top = pos->top + quad.height;
im_rect_intersectrect( &quad, &image, &inter );
if( im_rect_isempty( &inter ) )
vips_rect_intersectrect( &quad, &image, &inter );
if( vips_rect_isempty( &inter ) )
layer->tiles[i].bits |= PYR_BL;
quad.left = pos->left + quad.width;
quad.top = pos->top + quad.height;
im_rect_intersectrect( &quad, &image, &inter );
if( im_rect_isempty( &inter ) )
vips_rect_intersectrect( &quad, &image, &inter );
if( vips_rect_isempty( &inter ) )
layer->tiles[i].bits |= PYR_BR;
return( i );
}
/* Shrink a region by a factor of two, writing the result to a specified
* offset in another region. IM_CODING_LABQ only.
* offset in another region. VIPS_CODING_LABQ only.
*/
static void
shrink_region_labpack( REGION *from, Rect *area,
REGION *to, int xoff, int yoff )
shrink_region_labpack( VipsRegion *from, VipsRect *area,
VipsRegion *to, int xoff, int yoff )
{
int ls = IM_REGION_LSKIP( from );
Rect *t = &to->valid;
int ls = VIPS_REGION_LSKIP( from );
VipsRect *t = &to->valid;
int x, y;
Rect out;
VipsRect out;
/* Calculate output size and position.
*/
@ -786,10 +783,9 @@ shrink_region_labpack( REGION *from, Rect *area,
/* Shrink ... ignore the extension byte for speed.
*/
for( y = 0; y < out.height; y++ ) {
PEL *p = (PEL *)
IM_REGION_ADDR( from, area->left, area->top + y * 2 );
PEL *q = (PEL *)
IM_REGION_ADDR( to, out.left, out.top + y );
VipsPel *p = VIPS_REGION_ADDR( from,
area->left, area->top + y * 2 );
VipsPel *q = VIPS_REGION_ADDR( to, out.left, out.top + y );
for( x = 0; x < out.width; x++ ) {
signed char *sp = (signed char *) p;
@ -855,16 +851,16 @@ shrink_region_labpack( REGION *from, Rect *area,
* offset in another region. n-band, non-complex.
*/
static void
shrink_region( REGION *from, Rect *area,
REGION *to, int xoff, int yoff )
shrink_region( VipsRegion *from, VipsRect *area,
VipsRegion *to, int xoff, int yoff )
{
int ls = IM_REGION_LSKIP( from );
int ps = IM_IMAGE_SIZEOF_PEL( from->im );
int ls = VIPS_REGION_LSKIP( from );
int ps = VIPS_IMAGE_SIZEOF_PEL( from->im );
int nb = from->im->Bands;
Rect *t = &to->valid;
VipsRect *t = &to->valid;
int x, y, z;
Rect out;
VipsRect out;
/* Calculate output size and position.
*/
@ -874,29 +870,29 @@ shrink_region( REGION *from, Rect *area,
out.height = area->height / 2;
for( y = 0; y < out.height; y++ ) {
PEL *p = (PEL *)
IM_REGION_ADDR( from, area->left, area->top + y * 2 );
PEL *q = (PEL *)
IM_REGION_ADDR( to, out.left, out.top + y );
VipsPel *p = VIPS_REGION_ADDR( from,
area->left, area->top + y * 2 );
VipsPel *q = VIPS_REGION_ADDR( to,
out.left, out.top + y );
/* Process this line of pels.
*/
switch( from->im->BandFmt ) {
case IM_BANDFMT_UCHAR:
case VIPS_FORMAT_UCHAR:
SHRINK_TYPE_INT( unsigned char ); break;
case IM_BANDFMT_CHAR:
case VIPS_FORMAT_CHAR:
SHRINK_TYPE_INT( signed char ); break;
case IM_BANDFMT_USHORT:
case VIPS_FORMAT_USHORT:
SHRINK_TYPE_INT( unsigned short ); break;
case IM_BANDFMT_SHORT:
case VIPS_FORMAT_SHORT:
SHRINK_TYPE_INT( signed short ); break;
case IM_BANDFMT_UINT:
case VIPS_FORMAT_UINT:
SHRINK_TYPE_INT( unsigned int ); break;
case IM_BANDFMT_INT:
case VIPS_FORMAT_INT:
SHRINK_TYPE_INT( signed int ); break;
case IM_BANDFMT_FLOAT:
case VIPS_FORMAT_FLOAT:
SHRINK_TYPE_FLOAT( float ); break;
case IM_BANDFMT_DOUBLE:
case VIPS_FORMAT_DOUBLE:
SHRINK_TYPE_FLOAT( double ); break;
default:
@ -908,7 +904,7 @@ shrink_region( REGION *from, Rect *area,
/* Write a tile from a layer.
*/
static int
save_tile( TiffWrite *tw, TIFF *tif, PEL *tbuf, REGION *reg, Rect *area )
save_tile( TiffWrite *tw, TIFF *tif, VipsPel *tbuf, VipsRegion *reg, VipsRect *area )
{
/* Have to repack pixels.
*/
@ -923,7 +919,7 @@ save_tile( TiffWrite *tw, TIFF *tif, PEL *tbuf, REGION *reg, Rect *area )
/* Write to TIFF! easy.
*/
if( TIFFWriteTile( tif, tbuf, area->left, area->top, 0, 0 ) < 0 ) {
im_error( "vips2tiff", "%s", _( "TIFF write tile failed" ) );
vips_error( "vips2tiff", "%s", _( "TIFF write tile failed" ) );
return( -1 );
}
@ -934,13 +930,13 @@ save_tile( TiffWrite *tw, TIFF *tif, PEL *tbuf, REGION *reg, Rect *area )
* it and recurse.
*/
static int
new_tile( PyramidLayer *layer, REGION *tile, Rect *area )
new_tile( PyramidLayer *layer, VipsRegion *tile, VipsRect *area )
{
TiffWrite *tw = layer->tw;
int xoff, yoff;
int t, ri, bo;
Rect out, new;
VipsRect out, new;
PyramidBits bit;
/* Calculate pos and size of new pixels we make inside this layer.
@ -953,7 +949,7 @@ new_tile( PyramidLayer *layer, REGION *tile, Rect *area )
/* Has size fallen to zero? Can happen if this is a one-pixel-wide
* strip.
*/
if( im_rect_isempty( &new ) )
if( vips_rect_isempty( &new ) )
return( 0 );
/* Offset into this tile ... ie. which quadrant we are writing.
@ -968,8 +964,8 @@ new_tile( PyramidLayer *layer, REGION *tile, Rect *area )
/* Clip against edge of image.
*/
ri = IM_MIN( layer->width, out.left + layer->tw->tilew );
bo = IM_MIN( layer->height, out.top + layer->tw->tileh );
ri = VIPS_MIN( layer->width, out.left + layer->tw->tilew );
bo = VIPS_MIN( layer->height, out.top + layer->tw->tileh );
out.width = ri - out.left;
out.height = bo - out.top;
@ -978,7 +974,7 @@ new_tile( PyramidLayer *layer, REGION *tile, Rect *area )
/* Shrink into place.
*/
if( tw->im->Coding == IM_CODING_NONE )
if( tw->im->Coding == VIPS_CODING_NONE )
shrink_region( tile, area,
layer->tiles[t].tile, xoff, yoff );
else
@ -998,7 +994,7 @@ new_tile( PyramidLayer *layer, REGION *tile, Rect *area )
else
bit = PYR_TL;
if( layer->tiles[t].bits & bit ) {
im_error( "vips2tiff",
vips_error( "vips2tiff",
"%s", _( "internal error #9876345" ) );
return( -1 );
}
@ -1027,7 +1023,7 @@ new_tile( PyramidLayer *layer, REGION *tile, Rect *area )
* generated.
*/
static int
write_tif_tile( REGION *out, void *seq, void *a, void *b, gboolean *stop )
write_tif_tile( VipsRegion *out, void *seq, void *a, void *b, gboolean *stop )
{
TiffWrite *tw = (TiffWrite *) a;
@ -1058,10 +1054,10 @@ write_tif_tile( REGION *out, void *seq, void *a, void *b, gboolean *stop )
static int
write_tif_tilewise( TiffWrite *tw )
{
IMAGE *im = tw->im;
VipsImage *im = tw->im;
g_assert( !tw->tbuf );
if( !(tw->tbuf = im_malloc( NULL, TIFFTileSize( tw->tif ) )) )
if( !(tw->tbuf = vips_malloc( NULL, TIFFTileSize( tw->tif ) )) )
return( -1 );
g_assert( !tw->write_lock );
@ -1082,24 +1078,24 @@ write_tif_tilewise( TiffWrite *tw )
}
static int
write_tif_block( REGION *region, Rect *area, void *a )
write_tif_block( VipsRegion *region, VipsRect *area, void *a )
{
TiffWrite *tw = (TiffWrite *) a;
IMAGE *im = tw->im;
VipsImage *im = tw->im;
int y;
for( y = 0; y < area->height; y++ ) {
PEL *p = (PEL *) IM_REGION_ADDR( region, 0, area->top + y );
VipsPel *p = VIPS_REGION_ADDR( region, 0, area->top + y );
/* Any repacking necessary.
*/
if( im->Coding == IM_CODING_LABQ ) {
if( im->Coding == VIPS_CODING_LABQ ) {
LabQ2LabC( tw->tbuf, p, im->Xsize );
p = tw->tbuf;
}
else if( im->BandFmt == IM_BANDFMT_SHORT &&
im->Type == IM_TYPE_LABS ) {
else if( im->BandFmt == VIPS_FORMAT_SHORT &&
im->Type == VIPS_INTERPRETATION_LABS ) {
LabS2Lab16( tw->tbuf, p, im->Xsize );
p = tw->tbuf;
}
@ -1122,7 +1118,7 @@ write_tif_stripwise( TiffWrite *tw )
{
g_assert( !tw->tbuf );
if( !(tw->tbuf = im_malloc( NULL, TIFFScanlineSize( tw->tif ) )) )
if( !(tw->tbuf = vips_malloc( NULL, TIFFScanlineSize( tw->tif ) )) )
return( -1 );
if( vips_sink_disc( tw->im, write_tif_block, tw ) )
@ -1159,11 +1155,11 @@ free_tiff_write( TiffWrite *tw )
delete_files( tw );
#endif /*DEBUG*/
IM_FREEF( TIFFClose, tw->tif );
IM_FREEF( im_free, tw->tbuf );
IM_FREEF( g_mutex_free, tw->write_lock );
IM_FREEF( free_pyramid, tw->layer );
IM_FREEF( im_free, tw->icc_profile );
VIPS_FREEF( TIFFClose, tw->tif );
VIPS_FREEF( vips_free, tw->tbuf );
VIPS_FREEF( g_mutex_free, tw->write_lock );
VIPS_FREEF( free_pyramid, tw->layer );
VIPS_FREEF( vips_free, tw->icc_profile );
}
/* Round N down to P boundary.
@ -1213,7 +1209,7 @@ get_resunit( VipsForeignTiffResunit resunit )
/* Make and init a TiffWrite.
*/
static TiffWrite *
make_tiff_write( IMAGE *im, const char *filename,
make_tiff_write( VipsImage *im, const char *filename,
VipsForeignTiffCompression compression, int Q,
VipsForeignTiffPredictor predictor,
char *profile,
@ -1225,10 +1221,10 @@ make_tiff_write( IMAGE *im, const char *filename,
{
TiffWrite *tw;
if( !(tw = IM_NEW( im, TiffWrite )) )
if( !(tw = VIPS_NEW( im, TiffWrite )) )
return( NULL );
tw->im = im;
tw->name = im_strdup( im, filename );
tw->name = vips_strdup( VIPS_OBJECT( im ), filename );
tw->bname = NULL;
tw->tif = NULL;
tw->layer = NULL;
@ -1251,13 +1247,13 @@ make_tiff_write( IMAGE *im, const char *filename,
if( (tw->tilew & 0xf) != 0 ||
(tw->tileh & 0xf) != 0 ) {
im_error( "vips2tiff",
vips_error( "vips2tiff",
"%s", _( "tile size not a multiple of 16" ) );
return( NULL );
}
if( !tw->tile && tw->pyramid ) {
im_warn( "vips2tiff",
vips_warn( "vips2tiff",
"%s", _( "can't have strip pyramid -- "
"enabling tiling" ) );
tw->tile = 1;
@ -1266,9 +1262,9 @@ make_tiff_write( IMAGE *im, const char *filename,
/* We can only pyramid LABQ and non-complex images.
*/
if( tw->pyramid ) {
if( im->Coding == IM_CODING_NONE &&
if( im->Coding == VIPS_CODING_NONE &&
vips_bandfmt_iscomplex( im->BandFmt ) ) {
im_error( "vips2tiff",
vips_error( "vips2tiff",
"%s", _( "can only pyramid LABQ and "
"non-complex images" ) );
return( NULL );
@ -1278,26 +1274,26 @@ make_tiff_write( IMAGE *im, const char *filename,
/* Only 1-bit-ize 8 bit mono images.
*/
if( tw->onebit ) {
if( im->Coding != IM_CODING_NONE ||
im->BandFmt != IM_BANDFMT_UCHAR ||
if( im->Coding != VIPS_CODING_NONE ||
im->BandFmt != VIPS_FORMAT_UCHAR ||
im->Bands != 1 )
tw->onebit = 0;
}
if( tw->onebit && tw->compression == COMPRESSION_JPEG ) {
im_warn( "vips2tiff",
vips_warn( "vips2tiff",
"%s", _( "can't have 1-bit JPEG -- disabling JPEG" ) );
tw->compression = COMPRESSION_NONE;
}
/* Sizeof a line of bytes in the TIFF tile.
*/
if( im->Coding == IM_CODING_LABQ )
if( im->Coding == VIPS_CODING_LABQ )
tw->tls = tw->tilew * 3;
else if( tw->onebit )
tw->tls = ROUND_UP( tw->tilew, 8 ) / 8;
else
tw->tls = IM_IMAGE_SIZEOF_PEL( im ) * tw->tilew;
tw->tls = VIPS_IMAGE_SIZEOF_PEL( im ) * tw->tilew;
return( tw );
}
@ -1352,7 +1348,7 @@ tiff_copy( TiffWrite *tw, TIFF *out, TIFF *in )
if( embed_profile( tw, out ) )
return( -1 );
buf = im_malloc( NULL, TIFFTileSize( in ) );
buf = vips_malloc( NULL, TIFFTileSize( in ) );
n = TIFFNumberOfTiles( in );
for( tile = 0; tile < n; tile++ ) {
tsize_t len;
@ -1364,11 +1360,11 @@ tiff_copy( TiffWrite *tw, TIFF *out, TIFF *in )
len = TIFFReadEncodedTile( in, tile, buf, (tsize_t) -1 );
if( len < 0 ||
TIFFWriteEncodedTile( out, tile, buf, len ) < 0 ) {
im_free( buf );
vips_free( buf );
return( -1 );
}
}
im_free( buf );
vips_free( buf );
return( 0 );
}
@ -1446,7 +1442,7 @@ vips__tiff_write( VipsImage *in, const char *filename,
int res;
#ifdef DEBUG
printf( "im_tiff2vips: libtiff version is \"%s\"\n", TIFFGetVersion() );
printf( "tiff2vips: libtiff version is \"%s\"\n", TIFFGetVersion() );
#endif /*DEBUG*/
/* Override the default TIFF error handler.
@ -1456,22 +1452,21 @@ vips__tiff_write( VipsImage *in, const char *filename,
/* Check input image.
*/
if( im_pincheck( in ) ||
im_check_coding_known( "vips2tiff", in ) )
if( vips_check_coding_known( "vips2tiff", in ) )
return( -1 );
if( in->BandFmt != IM_BANDFMT_UCHAR &&
!(in->BandFmt == IM_BANDFMT_SHORT &&
in->Type == IM_TYPE_LABS) &&
in->BandFmt != IM_BANDFMT_USHORT &&
in->BandFmt != IM_BANDFMT_FLOAT ) {
im_error( "vips2tiff", "%s",
if( in->BandFmt != VIPS_FORMAT_UCHAR &&
!(in->BandFmt == VIPS_FORMAT_SHORT &&
in->Type == VIPS_INTERPRETATION_LABS) &&
in->BandFmt != VIPS_FORMAT_USHORT &&
in->BandFmt != VIPS_FORMAT_FLOAT ) {
vips_error( "vips2tiff", "%s",
_( "unsigned 8-bit int, 16-bit int, "
"and 32-bit float only" ) );
return( -1 );
}
if( in->Coding == IM_CODING_NONE ) {
if( in->Coding == VIPS_CODING_NONE ) {
if( in->Bands < 1 || in->Bands > 5 ) {
im_error( "vips2tiff",
vips_error( "vips2tiff",
"%s", _( "1 to 5 bands only" ) );
return( -1 );
}
@ -1486,7 +1481,7 @@ vips__tiff_write( VipsImage *in, const char *filename,
resunit, xres, yres, bigtiff )) )
return( -1 );
if( tw->pyramid ) {
if( !(tw->bname = im__temp_name( "%s.tif" )) ||
if( !(tw->bname = vips__temp_name( "%s.tif" )) ||
!(tw->tif = tiff_openout( tw, tw->bname )) ) {
free_tiff_write( tw );
return( -1 );

View File

@ -200,7 +200,7 @@ ideal_bpf( IMAGE *out, double fcx, double fcy, double r )
cpline++;
}
if( im_writeline( y, out, (PEL *) line ) )
if( im_writeline( y, out, (VipsPel *) line ) )
return( -1 );
}
@ -270,7 +270,7 @@ ideal_brf( IMAGE *out, double fcx, double fcy, double r )
cpline++;
}
if( im_writeline( y, out, (PEL *) line ) )
if( im_writeline( y, out, (VipsPel *) line ) )
return( -1 );
}
@ -363,7 +363,7 @@ butterworth_bpf( IMAGE *out,
cpline++;
}
if( im_writeline( y, out, (PEL *) line ) )
if( im_writeline( y, out, (VipsPel *) line ) )
return( -1 );
}
@ -447,7 +447,7 @@ butterworth_brf( IMAGE *out,
cpline++;
}
if( im_writeline( y, out, (PEL *) line ) )
if( im_writeline( y, out, (VipsPel *) line ) )
return( -1 );
}
@ -525,7 +525,7 @@ gaussian_bpf( IMAGE *out, double fcx, double fcy, double r, double ac )
cpline++;
}
if( im_writeline( y, out, (PEL *) line ) )
if( im_writeline( y, out, (VipsPel *) line ) )
return( -1 );
}
@ -605,7 +605,7 @@ gaussian_brf( IMAGE *out, double fcx, double fcy, double r, double ac )
cpline++;
}
if( im_writeline( y, out, (PEL *) line ) )
if( im_writeline( y, out, (VipsPel *) line ) )
return( -1 );
}

View File

@ -73,7 +73,7 @@ copy_quarter( IMAGE *out, float *coeff_s )
*cpline++ = *cpcoeff++;
for( x = out->Xsize/2; x < out->Xsize; x++ )
*cpline++ = *cpcoeff--;
if( im_writeline( y, out, (PEL *) line ) )
if( im_writeline( y, out, (VipsPel *) line ) )
return( -1 );
}
@ -85,7 +85,7 @@ copy_quarter( IMAGE *out, float *coeff_s )
*cpline++ = *cpcoeff++;
for( x = out->Xsize/2; x < out->Xsize; x++ )
*cpline++ = *cpcoeff--;
if( im_writeline( y, out, (PEL *) line ) )
if( im_writeline( y, out, (VipsPel *) line ) )
return( -1 );
}

View File

@ -132,7 +132,7 @@ rfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
if( im_setupout( out ) )
return( -1 );
if( !(buf = (double *) IM_ARRAY( dummy,
IM_IMAGE_SIZEOF_LINE( out ), PEL )) )
IM_IMAGE_SIZEOF_LINE( out ), VipsPel )) )
return( -1 );
/* Copy to out and normalise. The right half is the up/down and
@ -158,7 +158,7 @@ rfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
q += 2;
}
if( im_writeline( 0, out, (PEL *) buf ) )
if( im_writeline( 0, out, (VipsPel *) buf ) )
return( -1 );
for( y = 1; y < out->Ysize; y++ ) {
@ -185,7 +185,7 @@ rfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
q += 2;
}
if( im_writeline( y, out, (PEL *) buf ) )
if( im_writeline( y, out, (VipsPel *) buf ) )
return( -1 );
}
@ -235,7 +235,7 @@ cfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
if( im_setupout( out ) )
return( -1 );
if( !(buf = (double *) IM_ARRAY( dummy,
IM_IMAGE_SIZEOF_LINE( out ), PEL )) )
IM_IMAGE_SIZEOF_LINE( out ), VipsPel )) )
return( -1 );
/* Copy to out, normalise.
@ -252,7 +252,7 @@ cfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
q += 2;
}
if( im_writeline( y, out, (PEL *) buf ) )
if( im_writeline( y, out, (VipsPel *) buf ) )
return( -1 );
}
@ -329,7 +329,7 @@ rfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
if( im_setupout( out ) )
return( -1 );
if( !(buf = (double *) IM_ARRAY( dummy,
IM_IMAGE_SIZEOF_LINE( out ), PEL )) )
IM_IMAGE_SIZEOF_LINE( out ), VipsPel )) )
return( -1 );
/* Copy to out and normalise. The right half is the up/down and
@ -355,7 +355,7 @@ rfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
q += 2;
}
if( im_writeline( 0, out, (PEL *) buf ) )
if( im_writeline( 0, out, (VipsPel *) buf ) )
return( -1 );
for( y = 1; y < out->Ysize; y++ ) {
@ -382,7 +382,7 @@ rfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
q += 2;
}
if( im_writeline( y, out, (PEL *) buf ) )
if( im_writeline( y, out, (VipsPel *) buf ) )
return( -1 );
}
@ -442,7 +442,7 @@ cfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
if( im_setupout( out ) )
return( -1 );
if( !(buf = (double *) IM_ARRAY( dummy,
IM_IMAGE_SIZEOF_LINE( out ), PEL )) )
IM_IMAGE_SIZEOF_LINE( out ), VipsPel )) )
return( -1 );
/* Copy to out, normalise.
@ -459,7 +459,7 @@ cfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
q += 2;
}
if( im_writeline( y, out, (PEL *) buf ) )
if( im_writeline( y, out, (VipsPel *) buf ) )
return( -1 );
}
@ -540,7 +540,7 @@ fwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
if( im_setupout( out ) )
return( -1 );
if( !(buf = (float *) IM_ARRAY( dummy,
IM_IMAGE_SIZEOF_LINE( out ), PEL )) )
IM_IMAGE_SIZEOF_LINE( out ), VipsPel )) )
return( -1 );
/* Gather together real and imag parts. We have to normalise output!
@ -555,7 +555,7 @@ fwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
q += 2;
}
if( im_writeline( y, out, (PEL *) buf ) )
if( im_writeline( y, out, (VipsPel *) buf ) )
return( -1 );
}

View File

@ -230,7 +230,7 @@ invfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
if( im_setupout( out ) )
return( -1 );
if( !(buf = (float *) IM_ARRAY( dummy,
IM_IMAGE_SIZEOF_LINE( out ), PEL )) )
IM_IMAGE_SIZEOF_LINE( out ), VipsPel )) )
return( -1 );
/* Gather together real and imag parts.
@ -245,7 +245,7 @@ invfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
q += 2;
}
if( im_writeline( y, out, (PEL *) buf ) )
if( im_writeline( y, out, (VipsPel *) buf ) )
return( -1 );
}

View File

@ -281,7 +281,7 @@ invfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
if( im_setupout( out ) )
return( -1 );
if( !(buf = (float *) IM_ARRAY( dummy,
IM_IMAGE_SIZEOF_LINE( out ), PEL )) )
IM_IMAGE_SIZEOF_LINE( out ), VipsPel )) )
return( -1 );
/* Just write real part.
@ -293,7 +293,7 @@ invfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
q[x] = *p1++;
}
if( im_writeline( y, out, (PEL *) buf ) )
if( im_writeline( y, out, (VipsPel *) buf ) )
return( -1 );
}

View File

@ -290,7 +290,7 @@ im_buildlut( DOUBLEMASK *input, IMAGE *output )
IM_BBITS_DOUBLE, IM_BANDFMT_DOUBLE,
IM_CODING_NONE, IM_TYPE_HISTOGRAM, 1.0, 1.0, 0, 0 );
if( im_setupout( output ) ||
im_writeline( 0, output, (PEL *) state.buf ) ) {
im_writeline( 0, output, (VipsPel *) state.buf ) ) {
free_state( &state );
return( -1 );
}

View File

@ -90,7 +90,7 @@ im_histcum( IMAGE *in, IMAGE *out )
in->Bands * 2 : in->Bands;
const int mx = px * nb;
PEL *outbuf;
VipsPel *outbuf;
int b, x;
if( im_check_uncoded( "im_histcum", in ) ||

View File

@ -148,7 +148,7 @@ find_uchar_hist( REGION *reg, void *seq, void *a, void *b, gboolean *stop )
/* Accumulate!
*/
for( y = to; y < bo; y++ ) {
PEL *p = (PEL *) IM_REGION_ADDR( reg, le, y );
VipsPel *p = IM_REGION_ADDR( reg, le, y );
int i;
for( i = 0, x = 0; x < r->width; x++ )
@ -183,7 +183,7 @@ find_uchar_hist_extract( REGION *reg,
/* Accumulate!
*/
for( y = to; y < bo; y++ ) {
PEL *p = (PEL *) IM_REGION_ADDR( reg, le, y );
VipsPel *p = IM_REGION_ADDR( reg, le, y );
for( x = hist->which; x < max; x += nb )
bins[p[x]]++;
@ -370,7 +370,7 @@ im_histgr( IMAGE *in, IMAGE *out, int bandno )
/* Write interleaved buffer into hist.
*/
if( im_writeline( 0, out, (PEL *) obuffer ) )
if( im_writeline( 0, out, (VipsPel *) obuffer ) )
return( -1 );
return( 0 );

View File

@ -169,8 +169,8 @@ hist_scan_uchar( REGION *reg, void *seq, void *a, void *b, gboolean *stop )
/* Accumulate!
*/
for( y = 0; y < r->height; y++ ) {
PEL *i = (PEL *) IM_REGION_ADDR( reg, r->left, r->top + y );
PEL *v = (PEL *) IM_REGION_ADDR( hist->vreg,
VipsPel *i = IM_REGION_ADDR( reg, r->left, r->top + y );
VipsPel *v = IM_REGION_ADDR( hist->vreg,
r->left, r->top + y );
switch( value->BandFmt ) {
@ -247,7 +247,7 @@ hist_scan_ushort( REGION *reg, void *seq, void *a, void *b, gboolean *stop )
for( y = 0; y < r->height; y++ ) {
unsigned short *i = (unsigned short *) IM_REGION_ADDR( reg,
r->left, r->top + y );
PEL *v = (PEL *) IM_REGION_ADDR( hist->vreg,
VipsPel *v = IM_REGION_ADDR( hist->vreg,
r->left, r->top + y );
switch( value->BandFmt ) {
@ -292,7 +292,7 @@ hist_write( IMAGE *out, Histogram *hist )
if( im_setupout( out ) )
return( -1 );
if( im_writeline( 0, out, (PEL *) hist->bins ) )
if( im_writeline( 0, out, (VipsPel *) hist->bins ) )
return( -1 );
return( 0 );

View File

@ -171,7 +171,7 @@ find_hist( REGION *reg, void *seq, void *a, void *b, gboolean *stop )
/* Accumulate!
*/
for( y = to; y < bo; y++ ) {
PEL *line = IM_REGION_ADDR( reg, le, y );
VipsPel *line = IM_REGION_ADDR( reg, le, y );
switch( im->BandFmt ) {
case IM_BANDFMT_UCHAR:
@ -261,7 +261,7 @@ im_histnD( IMAGE *in, IMAGE *out, int bins )
for( z = 0; z < out->Bands; z++, i++ )
obuffer[i] = mhist->data[z][y][x];
if( im_writeline( y, out, (PEL *) obuffer ) )
if( im_writeline( y, out, (VipsPel *) obuffer ) )
return( -1 );
}

View File

@ -145,8 +145,8 @@ make_vert_gen( REGION *or, void *seq, void *a, void *b )
int x, y, z;
for( y = to; y < bo; y++ ) {
PEL *q = (PEL *) IM_REGION_ADDR( or, le, y );
PEL *p = (PEL *) IM_IMAGE_ADDR( in, 0, y );
VipsPel *q = IM_REGION_ADDR( or, le, y );
VipsPel *p = IM_IMAGE_ADDR( in, 0, y );
switch( in->BandFmt ) {
case IM_BANDFMT_UCHAR: VERT( unsigned char ); break;
@ -195,8 +195,8 @@ make_horz_gen( REGION *or, void *seq, void *a, void *b )
int x, y, z;
for( x = le; x < ri; x++ ) {
PEL *q = (PEL *) IM_REGION_ADDR( or, x, to );
PEL *p = (PEL *) IM_IMAGE_ADDR( in, x, 0 );
VipsPel *q = IM_REGION_ADDR( or, x, to );
VipsPel *p = IM_IMAGE_ADDR( in, x, 0 );
switch( in->BandFmt ) {
case IM_BANDFMT_UCHAR: HORZ( unsigned char ); break;

View File

@ -149,7 +149,7 @@ match( IMAGE *in, IMAGE *ref, IMAGE *out )
if( im_setupout( out ) )
return( -1 );
if( im_writeline( 0, out, (PEL *) outbuf ) )
if( im_writeline( 0, out, (VipsPel *) outbuf ) )
return( -1 );
return( 0 );

View File

@ -166,7 +166,7 @@ im_identity_ushort( IMAGE *lut, int bands, int sz )
for( p = buf, x = 0; x < sz; x++ )
for( z = 0; z < bands; z++ )
*p++ = x;
if( im_writeline( 0, lut, (PEL *) buf ) )
if( im_writeline( 0, lut, (VipsPel *) buf ) )
return( -1 );
return( 0 );

View File

@ -93,10 +93,10 @@ lhist_gen( REGION *or, void *seq, void *a, void *b )
for( y = 0; y < r->height; y++ ) {
/* Get input and output pointers for this line.
*/
PEL *p = (PEL *) IM_REGION_ADDR( ir, r->left, r->top + y );
PEL *q = (PEL *) IM_REGION_ADDR( or, r->left, r->top + y );
VipsPel *p = IM_REGION_ADDR( ir, r->left, r->top + y );
VipsPel *q = IM_REGION_ADDR( or, r->left, r->top + y );
PEL *p1;
VipsPel *p1;
int hist[256];
/* Find histogram for start of this line.

View File

@ -76,7 +76,7 @@ typedef struct {
int es; /* IM_IMAGE_SIZEOF_ELEMENT() for lut image */
int sz; /* Number of elements in minor dimension */
int clp; /* Value we clip against */
PEL **table; /* Lut converted to 2d array */
VipsPel **table; /* Lut converted to 2d array */
int overflow; /* Number of overflows for non-uchar lut */
} LutInfo;
@ -107,7 +107,7 @@ build_luts( IMAGE *out, IMAGE *lut )
{
LutInfo *st;
int i, x;
PEL *q;
VipsPel *q;
if( !(st = IM_NEW( out, LutInfo )) )
return( NULL );
@ -130,15 +130,15 @@ build_luts( IMAGE *out, IMAGE *lut )
/* Attach tables.
*/
if( !(st->table = IM_ARRAY( out, lut->Bands, PEL * )) )
if( !(st->table = IM_ARRAY( out, lut->Bands, VipsPel * )) )
return( NULL );
for( i = 0; i < lut->Bands; i++ )
if( !(st->table[i] = IM_ARRAY( out, st->sz * st->es, PEL )) )
if( !(st->table[i] = IM_ARRAY( out, st->sz * st->es, VipsPel )) )
return( NULL );
/* Scan LUT and fill table.
*/
q = (PEL *) lut->data;
q = (VipsPel *) lut->data;
for( x = 0; x < st->sz; x++ )
for( i = 0; i < st->nb; i++ ) {
memcpy( st->table[i] + x * st->es, q, st->es );
@ -201,7 +201,7 @@ maplut_start( IMAGE *out, void *a, void *b )
\
for( y = to; y < bo; y++ ) { \
for( z = 0; z < b; z++ ) { \
PEL *p = (PEL *) IM_REGION_ADDR( ir, le, y ); \
VipsPel *p = IM_REGION_ADDR( ir, le, y ); \
OUT *q = (OUT *) IM_REGION_ADDR( or, le, y ); \
OUT *tlut = (OUT *) st->table[z]; \
\
@ -218,7 +218,7 @@ maplut_start( IMAGE *out, void *a, void *b )
\
for( y = to; y < bo; y++ ) { \
for( z = 0; z < b; z++ ) { \
PEL *p = (PEL *) IM_REGION_ADDR( ir, le, y ) + z; \
VipsPel *p = IM_REGION_ADDR( ir, le, y ) + z; \
OUT *q = (OUT *) IM_REGION_ADDR( or, le, y ) + z * 2; \
OUT *tlut = (OUT *) st->table[z]; \
\
@ -289,7 +289,7 @@ maplut_start( IMAGE *out, void *a, void *b )
\
for( y = to; y < bo; y++ ) { \
OUT *q = (OUT *) IM_REGION_ADDR( or, le, y ); \
PEL *p = (PEL *) IM_REGION_ADDR( ir, le, y ); \
VipsPel *p = IM_REGION_ADDR( ir, le, y ); \
\
for( x = 0; x < ne; x++ ) \
q[x] = tlut[p[x]]; \
@ -303,7 +303,7 @@ maplut_start( IMAGE *out, void *a, void *b )
\
for( y = to; y < bo; y++ ) { \
OUT *q = (OUT *) IM_REGION_ADDR( or, le, y ); \
PEL *p = (PEL *) IM_REGION_ADDR( ir, le, y ); \
VipsPel *p = IM_REGION_ADDR( ir, le, y ); \
\
for( x = 0; x < ne; x++ ) { \
int n = p[x] * 2; \
@ -367,7 +367,7 @@ maplut_start( IMAGE *out, void *a, void *b )
\
for( y = to; y < bo; y++ ) { \
OUT *q = (OUT *) IM_REGION_ADDR( or, le, y ); \
PEL *p = (PEL *) IM_REGION_ADDR( ir, le, y ); \
VipsPel *p = IM_REGION_ADDR( ir, le, y ); \
\
for( i = 0, x = 0; x < np; x++ ) { \
int n = p[x]; \
@ -385,7 +385,7 @@ maplut_start( IMAGE *out, void *a, void *b )
\
for( y = to; y < bo; y++ ) { \
OUT *q = (OUT *) IM_REGION_ADDR( or, le, y ); \
PEL *p = (PEL *) IM_REGION_ADDR( ir, le, y ); \
VipsPel *p = IM_REGION_ADDR( ir, le, y ); \
\
for( x = 0; x < np; x++ ) { \
int n = p[x] * 2; \

View File

@ -292,10 +292,10 @@ im_project( IMAGE *in, IMAGE *hout, IMAGE *vout )
im_setupout( vout ) )
return( -1 );
if( im_writeline( 0, vout, (PEL *) mproject->columns ) )
if( im_writeline( 0, vout, (VipsPel *) mproject->columns ) )
return( -1 );
for( y = 0; y < in->Ysize; y++ )
if( im_writeline( y, hout, (PEL *) mproject->rows +
if( im_writeline( y, hout, (VipsPel *) mproject->rows +
y * IM_IMAGE_SIZEOF_PEL( hout ) ) )
return( -1 );

View File

@ -97,8 +97,8 @@ stdif_gen( REGION *or, void *seq, void *a, void *b )
for( y = 0; y < r->height; y++ ) {
/* Get input and output pointers for this line.
*/
PEL *p = (PEL *) IM_REGION_ADDR( ir, r->left, r->top + y );
PEL *q = (PEL *) IM_REGION_ADDR( or, r->left, r->top + y );
VipsPel *p = IM_REGION_ADDR( ir, r->left, r->top + y );
VipsPel *q = IM_REGION_ADDR( or, r->left, r->top + y );
/* Precompute some factors.
*/
@ -106,7 +106,7 @@ stdif_gen( REGION *or, void *seq, void *a, void *b )
double f2 = 1.0 - inf->a;
double f3 = inf->b * inf->s0;
PEL *p1;
VipsPel *p1;
int sum;
int sum2;

View File

@ -269,7 +269,7 @@ im_tone_build_range( IMAGE *out,
if( im_setupout( out ) )
return( -1 );
if( im_writeline( 0, out, (PEL *) lut ) )
if( im_writeline( 0, out, (VipsPel *) lut ) )
return( -1 );
return( 0 );

View File

@ -188,7 +188,7 @@ typedef struct _VipsForeignLoadClass {
GType vips_foreign_load_get_type( void );
const char *vips_foreign_find_load( const char *foreignname );
const char *vips_foreign_find_load( const char *filename );
VipsForeignFlags vips_foreign_flags( const char *loader, const char *filename );
gboolean vips_foreign_is_a( const char *loader, const char *filename );

View File

@ -282,7 +282,7 @@ typedef struct _VipsImage {
*/
char *Hist; /* don't use, see vips_image_get_history() */
char *filename; /* pointer to copy of filename */
PEL *data; /* start of image data for WIO */
VipsPel *data; /* start of image data for WIO */
int kill; /* set to non-zero to block eval */
/* Everything below this private and only used internally by
@ -448,7 +448,7 @@ extern const guint64 vips__image_sizeof_bandformat[];
(X), (Y), \
0, 0, \
(I)->Xsize, \
(I)->Ysize ), abort(), (PEL *) NULL) \
(I)->Ysize ), abort(), (VipsPel *) NULL) \
)
#else /*!VIPS_DEBUG*/
#define VIPS_IMAGE_ADDR( I, X, Y ) \
@ -493,7 +493,7 @@ int vips_image_pio_input( VipsImage *image );
int vips_image_inplace( VipsImage *image );
int vips_image_write_prepare( VipsImage *image );
int vips_image_write_line( VipsImage *image, int ypos, PEL *linebuffer );
int vips_image_write_line( VipsImage *image, int ypos, VipsPel *linebuffer );
gboolean vips_band_format_isint( VipsBandFormat format );
gboolean vips_band_format_isuint( VipsBandFormat format );

View File

@ -38,9 +38,9 @@ extern "C" {
#endif /*__cplusplus*/
int im_draw_rect( VipsImage *image,
int left, int top, int width, int height, int fill, PEL *ink );
int left, int top, int width, int height, int fill, VipsPel *ink );
int im_draw_circle( VipsImage *image,
int x, int y, int radius, gboolean fill, PEL *ink );
int x, int y, int radius, gboolean fill, VipsPel *ink );
int im_draw_image( VipsImage *image, VipsImage *sub, int x, int y );
@ -49,20 +49,22 @@ typedef int (*VipsPlotFn)( VipsImage *image, int x, int y,
int im_draw_line_user( VipsImage *image,
int x1, int y1, int x2, int y2,
VipsPlotFn plot, void *a, void *b, void *c );
int im_draw_line( VipsImage *image, int x1, int y1, int x2, int y2, PEL *ink );
int im_draw_line( VipsImage *image,
int x1, int y1, int x2, int y2, VipsPel *ink );
int im_lineset( VipsImage *in, VipsImage *out, VipsImage *mask, VipsImage *ink,
int n, int *x1v, int *y1v, int *x2v, int *y2v );
int im_draw_flood( VipsImage *image, int x, int y, PEL *ink, VipsRect *dout );
int im_draw_flood_blob( VipsImage *image, int x, int y, PEL *ink, VipsRect *dout );
int im_draw_flood( VipsImage *image, int x, int y, VipsPel *ink, VipsRect *dout );
int im_draw_flood_blob( VipsImage *image,
int x, int y, VipsPel *ink, VipsRect *dout );
int im_draw_flood_other( VipsImage *image, VipsImage *test,
int x, int y, int serial, VipsRect *dout );
int im_draw_mask( VipsImage *image,
VipsImage *mask_im, int x, int y, PEL *ink );
VipsImage *mask_im, int x, int y, VipsPel *ink );
int im_draw_point( VipsImage *image, int x, int y, PEL *ink );
int im_read_point( VipsImage *image, int x, int y, PEL *ink );
int im_draw_point( VipsImage *image, int x, int y, VipsPel *ink );
int im_read_point( VipsImage *image, int x, int y, VipsPel *ink );
int im_draw_smudge( VipsImage *image,
int left, int top, int width, int height );

View File

@ -233,8 +233,8 @@ typedef struct {
void imb_XYZ2Lab( float *, float *, int, im_colour_temperature * );
void imb_Lab2XYZ( float *, float *, int, im_colour_temperature * );
void imb_LabQ2Lab( PEL *, float *, int );
void imb_Lab2LabQ( float *, PEL *, int );
void imb_LabQ2Lab( VipsPel *, float *, int );
void imb_Lab2LabQ( float *, VipsPel *, int );
void imb_LabS2Lab( signed short *, float *, int );
void imb_Lab2LabS( float *, signed short *, int n );
@ -268,7 +268,7 @@ int im__fmaskcir( VipsImage *out, VipsMaskType flag, va_list ap );
/* inplace
*/
PEL *im__vector_to_ink( const char *domain, VipsImage *im, int n, double *vec );
VipsPel *im__vector_to_ink( const char *domain, VipsImage *im, int n, double *vec );
VipsImage *im__inplace_base( const char *domain,
VipsImage *main, VipsImage *sub, VipsImage *out );

View File

@ -55,8 +55,6 @@ extern "C" {
*/
#define VIPS_SIZEOF_HEADER (64)
typedef unsigned char PEL; /* useful datum */
/* What we track for each mmap window. Have a list of these on an openin
* VipsImage.
*/
@ -66,7 +64,7 @@ typedef struct {
int top; /* Area of image we have mapped, in pixels */
int height;
PEL *data; /* First pixel of line 'top' */
VipsPel *data; /* First pixel of line 'top' */
void *baseaddr; /* Base of window */
size_t length; /* Size of window */
@ -106,7 +104,7 @@ typedef struct _VipsBuffer {
VipsRect area; /* Area this pixel buffer covers */
gboolean done; /* Calculated and in cache */
VipsBufferCache *cache;
PEL *buf; /* Private malloc() area */
VipsPel *buf; /* Private malloc() area */
size_t bsize; /* Size of private malloc() */
} VipsBuffer;

View File

@ -69,7 +69,7 @@ typedef struct _VipsRegion {
*/
/*< private >*/
RegionType type; /* What kind of attachment */
PEL *data; /* Off here to get data */
VipsPel *data; /* Off here to get data */
int bpl; /* Bytes-per-line for data */
void *seq; /* Sequence we are using to fill region */
@ -109,7 +109,7 @@ int vips_region_equalsregion( VipsRegion *reg1, VipsRegion *reg2 );
int vips_region_position( VipsRegion *reg, int x, int y );
void vips_region_paint( VipsRegion *reg, VipsRect *r, int value );
void vips_region_paint_pel( VipsRegion *reg, VipsRect *r, PEL *ink );
void vips_region_paint_pel( VipsRegion *reg, VipsRect *r, VipsPel *ink );
void vips_region_black( VipsRegion *reg );
void vips_region_copy( VipsRegion *reg, VipsRegion *dest,
VipsRect *r, int x, int y );
@ -150,7 +150,7 @@ int vips_region_prepare_many( VipsRegion **reg, VipsRect *r );
(R)->valid.left, \
(R)->valid.top, \
(R)->valid.width, \
(R)->valid.height ), abort(), (PEL *) NULL) \
(R)->valid.height ), abort(), (VipsPel *) NULL) \
)
#else /*DEBUG*/
#define VIPS_REGION_ADDR( R, X, Y ) \

View File

@ -37,6 +37,14 @@
extern "C" {
#endif /*__cplusplus*/
/**
* VipsPel:
*
* A picture element. Cast this to whatever the associated VipsBandFormat says
* to get the value.
*/
typedef unsigned char VipsPel;
/* Also used for eg. vips_local() and friends.
*/
typedef int (*VipsCallbackFn)( void *a, void *b );

View File

@ -40,6 +40,8 @@ extern "C" {
/* Renamed types.
*/
#define PEL VipsPel
#define IM_BANDFMT_NOTSET VIPS_FORMAT_NOTSET
#define IM_BANDFMT_UCHAR VIPS_FORMAT_UCHAR
#define IM_BANDFMT_CHAR VIPS_FORMAT_CHAR

View File

@ -48,7 +48,7 @@
void
im__draw_scanline( Draw *draw, int y, int x1, int x2 )
{
PEL *mp;
VipsPel *mp;
int i;
int len;
@ -63,7 +63,7 @@ im__draw_scanline( Draw *draw, int y, int x1, int x2 )
x1 = IM_CLIP( 0, x1, draw->im->Xsize - 1 );
x2 = IM_CLIP( 0, x2, draw->im->Xsize - 1 );
mp = (PEL *) IM_IMAGE_ADDR( draw->im, x1, y );
mp = IM_IMAGE_ADDR( draw->im, x1, y );
len = x2 - x1 + 1;
for( i = 0; i < len; i++ ) {
@ -79,7 +79,7 @@ im__draw_free( Draw *draw )
}
Draw *
im__draw_init( Draw *draw, IMAGE *im, PEL *ink )
im__draw_init( Draw *draw, IMAGE *im, VipsPel *ink )
{
if( im_rwcheck( im ) )
return( NULL );
@ -92,7 +92,7 @@ im__draw_init( Draw *draw, IMAGE *im, PEL *ink )
draw->noclip = FALSE;
if( ink ) {
if( !(draw->ink = (PEL *) im_malloc( NULL, draw->psize )) )
if( !(draw->ink = (VipsPel *) im_malloc( NULL, draw->psize )) )
return( NULL );
memcpy( draw->ink, ink, draw->psize );
}

Some files were not shown because too many files have changed in this diff Show More