This commit is contained in:
John Cupitt 2009-11-04 12:49:10 +00:00
parent 5c88d473a9
commit ba0d928885
16 changed files with 237 additions and 214 deletions

View File

@ -1,30 +1,31 @@
noinst_LTLIBRARIES = libarithmetic.la noinst_LTLIBRARIES = libarithmetic.la
libarithmetic_la_SOURCES = \ libarithmetic_la_SOURCES = \
arith_dispatch.c \ arith_dispatch.c \
im_abs.c \ im_abs.c \
im_add.c \ im_add.c \
im_avg.c \ im_avg.c \
im_bandmean.c \ im_bandmean.c \
im_cross_phase.c \ im_cross_phase.c \
im_deviate.c \ im_deviate.c \
im_divide.c \ im_divide.c \
im_invert.c \ im_recomb.c \
im_linreg.c \ im_invert.c \
im_lintra.c \ im_linreg.c \
im_maxpos_avg.c \ im_lintra.c \
im_maxpos.c \ im_maxpos_avg.c \
im_maxpos_vec.c \ im_maxpos.c \
im_measure.c \ im_maxpos_vec.c \
im_minpos.c \ im_measure.c \
im_multiply.c \ im_minpos.c \
im_point_bilinear.c \ im_multiply.c \
im_remainder.c \ im_point_bilinear.c \
im_sign.c \ im_remainder.c \
im_stats.c \ im_sign.c \
im_subtract.c \ im_stats.c \
math.c \ im_subtract.c \
power.c \ math.c \
round.c power.c \
round.c
INCLUDES = -I${top_srcdir}/libvips/include @VIPS_CFLAGS@ @VIPS_INCLUDES@ INCLUDES = -I${top_srcdir}/libvips/include @VIPS_CFLAGS@ @VIPS_INCLUDES@

View File

@ -258,6 +258,35 @@ static im_arg_desc image_in_num_out[] = {
IM_OUTPUT_DOUBLE( "value" ) IM_OUTPUT_DOUBLE( "value" )
}; };
/* Args for im_recomb.
*/
static im_arg_desc recomb_args[] = {
IM_INPUT_IMAGE( "in" ),
IM_OUTPUT_IMAGE( "out" ),
IM_INPUT_DMASK( "matrix" )
};
/* Call im_recomb via arg vector.
*/
static int
recomb_vec( im_object *argv )
{
im_mask_object *mo = argv[2];
return( im_recomb( argv[0], argv[1], mo->mask ) );
}
/* Description of im_recomb.
*/
static im_function recomb_desc = {
"im_recomb", /* Name */
"linear recombination with mask",
IM_FN_PIO, /* Flags */
recomb_vec, /* Dispatch function */
IM_NUMBER( recomb_args ), /* Size of arg list */
recomb_args /* Arg list */
};
/* Call im_abs via arg vector. /* Call im_abs via arg vector.
*/ */
static int static int
@ -1421,6 +1450,7 @@ static im_function *arith_list[] = {
&multiply_desc, &multiply_desc,
&powtra_desc, &powtra_desc,
&powtra_vec_desc, &powtra_vec_desc,
&recomb_desc,
&remainder_desc, &remainder_desc,
&remainderconst_desc, &remainderconst_desc,
&remainder_vec_desc, &remainder_vec_desc,

View File

@ -1,31 +1,11 @@
/* @(#) Recombination of bands of image: perform a matrix mult of the form /* im_recomb.c
* @(#) *
* @(#) a1 b11 b21 .. bm1 c1
* @(#) a2 b12 b22 .. c2
* @(#) . = . . x .
* @(#) . . .
* @(#)
* @(#) an b1n bmn cm
* @(#)
* @(#) Where A is an n band output image, C is an m band input image and B
* @(#) is an mxn matrix of floats. Can be used with 3x3 matrix to perform
* @(#) simple colour space transforms; 7x30 matrix to shrink 3rd order
* @(#) development of 3 filter system to IM_TYPE_XYZ etc.
* @(#)
* @(#) Output is always float, unless input is double, in which case output
* @(#) is double. Does not work for complex images.
* @(#)
* @(#) Usage:
* @(#) im_recomb( imagein, imageout, mat )
* @(#) IMAGE *imagein, *imageout;
* @(#) DOUBLEMASK *mat;
* @(#)
* @(#) Returns: -1 on error, else 0
* 21/6/95 JC * 21/6/95 JC
* - mildly modernised * - mildly modernised
* 14/3/96 JC * 14/3/96 JC
* - better error checks, partial * - better error checks, partial
* - proper rounding behaviour for int types * 4/11/09
* - gtkdoc
*/ */
/* /*
@ -59,8 +39,6 @@
#endif /*HAVE_CONFIG_H*/ #endif /*HAVE_CONFIG_H*/
#include <vips/intl.h> #include <vips/intl.h>
#include <stdio.h>
#include <vips/vips.h> #include <vips/vips.h>
#ifdef WITH_DMALLOC #ifdef WITH_DMALLOC
@ -69,25 +47,24 @@
/* Inner loop. /* Inner loop.
*/ */
#define LOOP(INTYPE, OUTTYPE) \ #define LOOP( IN, OUT ) { \
{\ IN *p = (IN *) bin; \
INTYPE *p = (INTYPE *) bin;\ OUT *q = (OUT *) bout; \
OUTTYPE *q = (OUTTYPE *) bout;\
\ \
for( i = 0; i < width; i++ ) {\ for( i = 0; i < width; i++ ) { \
double *m = mat->coeff;\ double *m = mat->coeff; \
\ \
for( v = 0; v < mat->ysize; v++ ) {\ for( v = 0; v < mat->ysize; v++ ) { \
double t = 0.0;\ double t = 0.0; \
\ \
for( u = 0; u < mat->xsize; u++ )\ for( u = 0; u < mat->xsize; u++ ) \
t += *m++ * p[u];\ t += *m++ * p[u]; \
\ \
*q++ = (OUTTYPE) t;\ *q++ = (OUT) t; \
}\ } \
\ \
p += mat->xsize;\ p += mat->xsize; \
}\ } \
} }
/* Process a buffer of PELs. /* Process a buffer of PELs.
@ -111,30 +88,41 @@ recomb_buf( void *bin, void *bout, int width, IMAGE *in, DOUBLEMASK *mat )
case IM_BANDFMT_DOUBLE: LOOP( double, double ); break; case IM_BANDFMT_DOUBLE: LOOP( double, double ); break;
default: default:
im_error( "im_recomb", "%s", _( "unsupported input type" ) ); g_assert( 0 );
return( -1 );
} }
return( 0 ); return( 0 );
} }
/* Start here. /**
* im_recomb:
* @in: input image
* @out: output image
* @recomb: recombination matrix
*
* This operation recombines an image's bands. Each pixel in @in is treated as
* an n-element vector, where n is the number of bands in @in, and multipled by
* the n x m matrix @recomb to produce the m-band image @out.
*
* @out is always float, unless @in is double, in which case @out is double
* too. No complex images allowed.
*
* It's useful for various sorts of colour space conversions.
*
* Returns: 0 on success, -1 on error.
*/ */
int int
im_recomb( IMAGE *in, IMAGE *out, DOUBLEMASK *mat ) im_recomb( IMAGE *in, IMAGE *out, DOUBLEMASK *recomb )
{ {
DOUBLEMASK *mcpy; DOUBLEMASK *mcpy;
/* Check input image. /* Check input image.
*/ */
if( im_piocheck( in, out ) ) if( im_piocheck( in, out ) ||
im_check_uncoded( "im_recomb", in ) ||
im_check_noncomplex( "im_recomb", in ) )
return( -1 ); return( -1 );
if( in->Coding != IM_CODING_NONE || im_iscomplex( in ) ) { if( in->Bands != recomb->xsize ) {
im_error( "im_recomb", "%s",
_( "uncoded non-complex only" ) );
return( -1 );
}
if( in->Bands != mat->xsize ) {
im_error( "im_recomb", "%s", im_error( "im_recomb", "%s",
_( "bands in must equal matrix width" ) ); _( "bands in must equal matrix width" ) );
return( -1 ); return( -1 );
@ -144,7 +132,7 @@ im_recomb( IMAGE *in, IMAGE *out, DOUBLEMASK *mat )
*/ */
if( im_cp_desc( out, in ) ) if( im_cp_desc( out, in ) )
return( -1 ); return( -1 );
out->Bands = mat->ysize; out->Bands = recomb->ysize;
if( im_isint( in ) ) { if( im_isint( in ) ) {
out->Bbits = IM_BBITS_FLOAT; out->Bbits = IM_BBITS_FLOAT;
out->BandFmt = IM_BANDFMT_FLOAT; out->BandFmt = IM_BANDFMT_FLOAT;
@ -152,7 +140,7 @@ im_recomb( IMAGE *in, IMAGE *out, DOUBLEMASK *mat )
/* Take a copy of the matrix. /* Take a copy of the matrix.
*/ */
if( !(mcpy = im_dup_dmask( mat, "conv_mask" )) ) if( !(mcpy = im_dup_dmask( recomb, "conv_mask" )) )
return( -1 ); return( -1 );
if( im_add_close_callback( out, if( im_add_close_callback( out,
(im_callback_fn) im_free_dmask, mcpy, NULL ) ) { (im_callback_fn) im_free_dmask, mcpy, NULL ) ) {

View File

@ -1,7 +1,6 @@
noinst_LTLIBRARIES = libconversion.la noinst_LTLIBRARIES = libconversion.la
libconversion_la_SOURCES = \ libconversion_la_SOURCES = \
im_bernd.c \
conver_dispatch.c \ conver_dispatch.c \
im_bandjoin.c \ im_bandjoin.c \
im_black.c \ im_black.c \
@ -23,23 +22,18 @@ libconversion_la_SOURCES = \
im_lrjoin.c \ im_lrjoin.c \
im_mask2vips.c \ im_mask2vips.c \
im_msb.c \ im_msb.c \
im_recomb.c \
im_replicate.c \ im_replicate.c \
im_grid.c \ im_grid.c \
im_ri2c.c \ im_ri2c.c \
im_rightshift_size.c \
im_rot180.c \ im_rot180.c \
im_rot270.c \ im_rot270.c \
im_rot90.c \ im_rot90.c \
im_scale.c \ im_scale.c \
im_scaleps.c \ im_scaleps.c \
im_slice.c \
im_subsample.c \ im_subsample.c \
im_system.c \ im_system.c \
im_print.c \
im_tbjoin.c \ im_tbjoin.c \
im_text.c \ im_text.c \
im_thresh.c \
im_vips2mask.c \ im_vips2mask.c \
im_wrap.c \ im_wrap.c \
im_zoom.c im_zoom.c

View File

@ -40,6 +40,39 @@
#include <dmalloc.h> #include <dmalloc.h>
#endif /*WITH_DMALLOC*/ #endif /*WITH_DMALLOC*/
/**
* SECTION: conversion
* @short_description: convert images in some way: change band format, change header, insert, extract, join
* @see_also: <link linkend="libvips-resample">resample</link>
* @stability: Stable
* @include: vips/vips.h
*
* These operations convert an image in some way. They can be split into a two
* main groups:
*
* <itemizedlist>
* <listitem>
* <para>
* <emphasis><code>Format conversion</code></emphasis>
*
* The first set of operations change an image's format in some way. You
* can change the band format (for example, cast to 32-bit unsigned
* int), form complex images from real images, convert images to
* matrices and back, change header fields, and a few others.
* </para>
* </listitem>
* <listitem>
* <para>
* <emphasis><code>Lossless image manipulations</code></emphasis>
*
* The second group move pixels about in some way. You can flip, rotate,
* extract, insert and join pairs of iamges in various ways.
* </para>
* </listitem>
* </itemizedlist>
*
*/
static int static int
system_vec( im_object *argv ) system_vec( im_object *argv )
{ {
@ -98,41 +131,6 @@ static im_function subsample_desc = {
subsample_args /* Arg list */ subsample_args /* Arg list */
}; };
/* Args to im_bernd.
*/
static im_arg_desc bernd_args[] = {
IM_INPUT_STRING( "tiffname" ),
IM_INPUT_INT( "left" ),
IM_INPUT_INT( "top" ),
IM_INPUT_INT( "width" ),
IM_INPUT_INT( "height" )
};
/* Call im_bernd via arg vector.
*/
static int
bernd_vec( im_object *argv )
{
char *name = argv[0];
int left = *((int *) argv[1]);
int top = *((int *) argv[2]);
int width = *((int *) argv[3]);
int height = *((int *) argv[4]);
return( im_bernd( name, left, top, width, height ) );
}
/* Description of im_bernd.
*/
static im_function bernd_desc = {
"im_bernd", /* Name */
"extract from pyramid as jpeg", /* Description */
0, /* Flags */
bernd_vec, /* Dispatch function */
IM_NUMBER( bernd_args ), /* Size of arg list */
bernd_args /* Arg list */
};
/* Args to im_extract. /* Args to im_extract.
*/ */
static im_arg_desc extract_args[] = { static im_arg_desc extract_args[] = {
@ -838,35 +836,6 @@ static im_function falsecolour_desc = {
one_in_one_out /* Arg list */ one_in_one_out /* Arg list */
}; };
/* Args for im_recomb.
*/
static im_arg_desc recomb_args[] = {
IM_INPUT_IMAGE( "in" ),
IM_OUTPUT_IMAGE( "out" ),
IM_INPUT_DMASK( "matrix" )
};
/* Call im_recomb via arg vector.
*/
static int
recomb_vec( im_object *argv )
{
im_mask_object *mo = argv[2];
return( im_recomb( argv[0], argv[1], mo->mask ) );
}
/* Description of im_recomb.
*/
static im_function recomb_desc = {
"im_recomb", /* Name */
"linear recombination with mask",
IM_FN_PIO, /* Flags */
recomb_vec, /* Dispatch function */
IM_NUMBER( recomb_args ), /* Size of arg list */
recomb_args /* Arg list */
};
/* Args for im_insert. /* Args for im_insert.
*/ */
static im_arg_desc insert_args[] = { static im_arg_desc insert_args[] = {
@ -1258,41 +1227,6 @@ static im_function msb_band_desc = {
msb_band_args /* Arg list */ msb_band_args /* Arg list */
}; };
/* Args to im_rightshift_size.
*/
static im_arg_desc rightshift_size_args[] = {
IM_INPUT_IMAGE ("in"),
IM_OUTPUT_IMAGE ("out"),
IM_INPUT_INT ("xshift"),
IM_INPUT_INT ("yshift"),
IM_INPUT_INT ("band_fmt")
};
/* Call im_rightshift_size via arg vector.
*/
static int
rightshift_size_vec (im_object * argv)
{
IMAGE *in = (IMAGE *) argv[0];
IMAGE *out = (IMAGE *) argv[1];
int *xshift = (int *) argv[2];
int *yshift = (int *) argv[3];
int *band_fmt = (int *) argv[4];
return im_rightshift_size (in, out, *xshift, *yshift, *band_fmt );
}
/* Description of im_rightshift_size.
*/
static im_function rightshift_size_desc = {
"im_rightshift_size", /* Name */
"decrease size by a power-of-two factor",
IM_FN_PIO | IM_FN_TRANSFORM, /* Flags */
rightshift_size_vec, /* Dispatch function */
IM_NUMBER (rightshift_size_args), /* Size of arg list */
rightshift_size_args /* Arg list */
};
/* Args to im_wrap. /* Args to im_wrap.
*/ */
static im_arg_desc wrap_args[] = { static im_arg_desc wrap_args[] = {
@ -1362,7 +1296,6 @@ static im_function embed_desc = {
*/ */
static im_function *conv_list[] = { static im_function *conv_list[] = {
&bandjoin_desc, &bandjoin_desc,
&bernd_desc,
&black_desc, &black_desc,
&c2amph_desc, &c2amph_desc,
&c2imag_desc, &c2imag_desc,
@ -1394,7 +1327,6 @@ static im_function *conv_list[] = {
&mask2vips_desc, &mask2vips_desc,
&msb_desc, &msb_desc,
&msb_band_desc, &msb_band_desc,
&recomb_desc,
&replicate_desc, &replicate_desc,
&ri2c_desc, &ri2c_desc,
&rot180_desc, &rot180_desc,
@ -1402,7 +1334,6 @@ static im_function *conv_list[] = {
&rot90_desc, &rot90_desc,
&scale_desc, &scale_desc,
&scaleps_desc, &scaleps_desc,
&rightshift_size_desc,
&subsample_desc, &subsample_desc,
&system_desc, &system_desc,
&tbjoin_desc, &tbjoin_desc,

View File

@ -1,16 +1,20 @@
noinst_LTLIBRARIES = libdeprecated.la noinst_LTLIBRARIES = libdeprecated.la
libdeprecated_la_SOURCES = \ libdeprecated_la_SOURCES = \
deprecated_dispatch.c \ deprecated_dispatch.c \
im_fav4.c \ im_fav4.c \
im_gadd.c \ im_gadd.c \
im_gaddim.c \ im_gaddim.c \
im_cmulnorm.c \ im_cmulnorm.c \
im_printlines.c \ im_printlines.c \
im_debugim.c \ im_debugim.c \
im_gfadd.c \ im_gfadd.c \
im_setbox.c \ im_setbox.c \
rename.c \ rename.c \
im_litecor.c im_bernd.c \
im_thresh.c \
im_slice.c \
im_print.c \
im_litecor.c
INCLUDES = -I${top_srcdir}/libvips/include @VIPS_CFLAGS@ @VIPS_INCLUDES@ INCLUDES = -I${top_srcdir}/libvips/include @VIPS_CFLAGS@ @VIPS_INCLUDES@

View File

@ -619,6 +619,40 @@ static im_function slice_desc = {
slice_args /* Arg list */ slice_args /* Arg list */
}; };
/* Args to im_bernd.
*/
static im_arg_desc bernd_args[] = {
IM_INPUT_STRING( "tiffname" ),
IM_INPUT_INT( "left" ),
IM_INPUT_INT( "top" ),
IM_INPUT_INT( "width" ),
IM_INPUT_INT( "height" )
};
/* Call im_bernd via arg vector.
*/
static int
bernd_vec( im_object *argv )
{
char *name = argv[0];
int left = *((int *) argv[1]);
int top = *((int *) argv[2]);
int width = *((int *) argv[3]);
int height = *((int *) argv[4]);
return( im_bernd( name, left, top, width, height ) );
}
/* Description of im_bernd.
*/
static im_function bernd_desc = {
"im_bernd", /* Name */
"extract from pyramid as jpeg", /* Description */
0, /* Flags */
bernd_vec, /* Dispatch function */
IM_NUMBER( bernd_args ), /* Size of arg list */
bernd_args /* Arg list */
};
/* Package up all these functions. /* Package up all these functions.
*/ */
@ -641,6 +675,7 @@ static im_function *deprecated_list[] = {
&clip2us_desc, &clip2us_desc,
&print_desc, &print_desc,
&slice_desc, &slice_desc,
&bernd_desc,
&thresh_desc, &thresh_desc,
&similarity_area_desc, &similarity_area_desc,
&similarity_desc &similarity_desc

View File

@ -44,7 +44,6 @@ DOUBLEMASK *im_measure_area( IMAGE *im,
int h, int v, int h, int v,
int *sel, int nsel, const char *name ); int *sel, int nsel, const char *name );
DOUBLEMASK *im_stats( IMAGE *in ); DOUBLEMASK *im_stats( IMAGE *in );
int im_abs( IMAGE *in, IMAGE *out );
int im_max( IMAGE *in, double *out ); int im_max( IMAGE *in, double *out );
int im_min( IMAGE *in, double *out ); int im_min( IMAGE *in, double *out );
int im_avg( IMAGE *in, double *out ); int im_avg( IMAGE *in, double *out );
@ -54,17 +53,31 @@ int im_minpos( IMAGE *in, int *xpos, int *ypos, double *out );
int im_maxpos_avg( IMAGE *im, double *xpos, double *ypos, double *out ); int im_maxpos_avg( IMAGE *im, double *xpos, double *ypos, double *out );
int im_maxpos_vec( IMAGE *im, int *xpos, int *ypos, double *maxima, int n ); int im_maxpos_vec( IMAGE *im, int *xpos, int *ypos, double *maxima, int n );
int im_minpos_vec( IMAGE *im, int *xpos, int *ypos, double *minima, int n ); int im_minpos_vec( IMAGE *im, int *xpos, int *ypos, double *minima, int n );
int im_bandmean( IMAGE *in, IMAGE *out );
int im_add( IMAGE *in1, IMAGE *in2, IMAGE *out ); int im_add( IMAGE *in1, IMAGE *in2, IMAGE *out );
int im_subtract( IMAGE *in1, IMAGE *in2, IMAGE *out ); int im_subtract( IMAGE *in1, IMAGE *in2, IMAGE *out );
int im_invert( IMAGE *in, IMAGE *out ); int im_invert( IMAGE *in, IMAGE *out );
int im_linreg( IMAGE **ins, IMAGE *out, double *xs );
int im_lintra( double a, IMAGE *in, double b, IMAGE *out ); int im_lintra( double a, IMAGE *in, double b, IMAGE *out );
int im_lintra_vec( int n, double *a, IMAGE *in, double *b, IMAGE *out ); int im_lintra_vec( int n, double *a, IMAGE *in, double *b, IMAGE *out );
int im_multiply( IMAGE *in1, IMAGE *in2, IMAGE *out ); int im_multiply( IMAGE *in1, IMAGE *in2, IMAGE *out );
int im_divide( IMAGE *in1, IMAGE *in2, IMAGE *out ); int im_divide( IMAGE *in1, IMAGE *in2, IMAGE *out );
int im_remainder( IMAGE *in1, IMAGE *in2, IMAGE *out );
int im_remainder_vec( IMAGE *in, IMAGE *out, int n, double *c );
int im_remainderconst( IMAGE *in, IMAGE *out, double c );
int im_recomb( IMAGE *in, IMAGE *out, DOUBLEMASK *recomb );
int im_sign( IMAGE *in, IMAGE *out );
int im_abs( IMAGE *in, IMAGE *out );
int im_floor( IMAGE *in, IMAGE *out );
int im_rint( IMAGE *in, IMAGE *out );
int im_ceil( IMAGE *in, IMAGE *out );
int im_linreg( IMAGE **ins, IMAGE *out, double *xs );
int im_point( IMAGE *im, VipsInterpolate *interpolate, int im_point( IMAGE *im, VipsInterpolate *interpolate,
double x, double y, int band, double *out ); double x, double y, int band, double *out );
int im_point_bilinear( IMAGE *im, double x, double y, int band, double *out ); int im_point_bilinear( IMAGE *im, double x, double y, int band, double *out );
int im_powtra( IMAGE *in, IMAGE *out, double e ); int im_powtra( IMAGE *in, IMAGE *out, double e );
int im_powtra_vec( IMAGE *in, IMAGE *out, int n, double *e ); int im_powtra_vec( IMAGE *in, IMAGE *out, int n, double *e );
int im_exptra( IMAGE *in, IMAGE *out ); int im_exptra( IMAGE *in, IMAGE *out );
@ -73,20 +86,14 @@ int im_expntra( IMAGE *in, IMAGE *out, double e );
int im_expntra_vec( IMAGE *in, IMAGE *out, int n, double *e ); int im_expntra_vec( IMAGE *in, IMAGE *out, int n, double *e );
int im_logtra( IMAGE *in, IMAGE *out ); int im_logtra( IMAGE *in, IMAGE *out );
int im_log10tra( IMAGE *in, IMAGE *out ); int im_log10tra( IMAGE *in, IMAGE *out );
int im_remainder( IMAGE *in1, IMAGE *in2, IMAGE *out );
int im_remainder_vec( IMAGE *in, IMAGE *out, int n, double *c );
int im_remainderconst( IMAGE *in, IMAGE *out, double c );
int im_floor( IMAGE *in, IMAGE *out );
int im_rint( IMAGE *in, IMAGE *out );
int im_ceil( IMAGE *in, IMAGE *out );
int im_sintra( IMAGE *in, IMAGE *out ); int im_sintra( IMAGE *in, IMAGE *out );
int im_sign( IMAGE *in, IMAGE *out );
int im_costra( IMAGE *in, IMAGE *out ); int im_costra( IMAGE *in, IMAGE *out );
int im_tantra( IMAGE *in, IMAGE *out ); int im_tantra( IMAGE *in, IMAGE *out );
int im_asintra( IMAGE *in, IMAGE *out ); int im_asintra( IMAGE *in, IMAGE *out );
int im_acostra( IMAGE *in, IMAGE *out ); int im_acostra( IMAGE *in, IMAGE *out );
int im_atantra( IMAGE *in, IMAGE *out ); int im_atantra( IMAGE *in, IMAGE *out );
int im_bandmean( IMAGE *in, IMAGE *out );
int im_cross_phase( IMAGE *a, IMAGE *b, IMAGE *out ); int im_cross_phase( IMAGE *a, IMAGE *b, IMAGE *out );
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -61,10 +61,6 @@ int im_copy_swap( IMAGE *in, IMAGE *out );
int im_copy_from( IMAGE *in, IMAGE *out, im_arch_type architecture ); int im_copy_from( IMAGE *in, IMAGE *out, im_arch_type architecture );
int im_copy_file( IMAGE *in, IMAGE *out ); int im_copy_file( IMAGE *in, IMAGE *out );
int im_black( IMAGE *out, int, int, int );
int im_text( IMAGE *out, const char *text, const char *font,
int width, int alignment, int dpi );
int im_clip2fmt( IMAGE *in, IMAGE *out, int ofmt ); int im_clip2fmt( IMAGE *in, IMAGE *out, int ofmt );
int im_scale( IMAGE *in, IMAGE *out ); int im_scale( IMAGE *in, IMAGE *out );
int im_clip( IMAGE *in, IMAGE *out ); int im_clip( IMAGE *in, IMAGE *out );
@ -81,7 +77,9 @@ int im_scaleps( IMAGE *in, IMAGE *out );
int im_falsecolour( IMAGE *in, IMAGE *out ); int im_falsecolour( IMAGE *in, IMAGE *out );
int im_recomb( IMAGE *in, IMAGE *out, DOUBLEMASK *recomb ); int im_black( IMAGE *out, int, int, int );
int im_text( IMAGE *out, const char *text, const char *font,
int width, int alignment, int dpi );
int im_extract_band( IMAGE *in, IMAGE *out, int band ); int im_extract_band( IMAGE *in, IMAGE *out, int band );
int im_extract_bands( IMAGE *in, IMAGE *out, int band, int nbands ); int im_extract_bands( IMAGE *in, IMAGE *out, int band, int nbands );
@ -90,10 +88,8 @@ int im_extract_areabands( IMAGE *in, IMAGE *out,
int left, int top, int width, int height, int band, int nbands ); int left, int top, int width, int height, int band, int nbands );
int im_embed( IMAGE *in, IMAGE *out, int type, int im_embed( IMAGE *in, IMAGE *out, int type,
int left, int top, int width, int height ); int left, int top, int width, int height );
int im_bandjoin( IMAGE *in, IMAGE *out, IMAGE * ); int im_bandjoin( IMAGE *in, IMAGE *out, IMAGE * );
int im_gbandjoin( IMAGE **in, IMAGE *out, int ); int im_gbandjoin( IMAGE **in, IMAGE *out, int );
int im_insert( IMAGE *in, IMAGE *out, IMAGE *, int x, int y ); int im_insert( IMAGE *in, IMAGE *out, IMAGE *, int x, int y );
int im_insert_noexpand( IMAGE *in, IMAGE *out, IMAGE *, int x, int y ); int im_insert_noexpand( IMAGE *in, IMAGE *out, IMAGE *, int x, int y );
int im_lrjoin( IMAGE *in1, IMAGE *in2, IMAGE *out ); int im_lrjoin( IMAGE *in1, IMAGE *in2, IMAGE *out );

View File

@ -8,6 +8,7 @@ libresample_la_SOURCES = \
im_resize_linear.c \ im_resize_linear.c \
im_shrink.c \ im_shrink.c \
im_stretch3.c \ im_stretch3.c \
im_rightshift_size.c \
nohalo1.cpp \ nohalo1.cpp \
snohalo1.cpp \ snohalo1.cpp \
nohalo2.cpp \ nohalo2.cpp \

View File

@ -44,6 +44,41 @@
#include <dmalloc.h> #include <dmalloc.h>
#endif /*WITH_DMALLOC*/ #endif /*WITH_DMALLOC*/
/* Args to im_rightshift_size.
*/
static im_arg_desc rightshift_size_args[] = {
IM_INPUT_IMAGE ("in"),
IM_OUTPUT_IMAGE ("out"),
IM_INPUT_INT ("xshift"),
IM_INPUT_INT ("yshift"),
IM_INPUT_INT ("band_fmt")
};
/* Call im_rightshift_size via arg vector.
*/
static int
rightshift_size_vec (im_object * argv)
{
IMAGE *in = (IMAGE *) argv[0];
IMAGE *out = (IMAGE *) argv[1];
int *xshift = (int *) argv[2];
int *yshift = (int *) argv[3];
int *band_fmt = (int *) argv[4];
return im_rightshift_size (in, out, *xshift, *yshift, *band_fmt );
}
/* Description of im_rightshift_size.
*/
static im_function rightshift_size_desc = {
"im_rightshift_size", /* Name */
"decrease size by a power-of-two factor",
IM_FN_PIO | IM_FN_TRANSFORM, /* Flags */
rightshift_size_vec, /* Dispatch function */
IM_NUMBER (rightshift_size_args), /* Size of arg list */
rightshift_size_args /* Arg list */
};
/* affinei args /* affinei args
*/ */
static im_arg_desc affinei_args[] = { static im_arg_desc affinei_args[] = {
@ -233,6 +268,7 @@ static im_function stretch3_desc = {
*/ */
static im_function *resample_list[] = { static im_function *resample_list[] = {
&resize_linear_desc, &resize_linear_desc,
&rightshift_size_desc,
&shrink_desc, &shrink_desc,
&stretch3_desc, &stretch3_desc,
&affinei_desc, &affinei_desc,