deprecate _raw versions

This commit is contained in:
John Cupitt 2009-11-05 14:57:30 +00:00
parent a19c6cd175
commit 04f01d3e60
14 changed files with 500 additions and 466 deletions

View File

@ -73,6 +73,7 @@
- added im_col_display_get_table(), so display tables are now shared by name
- added im__colour_unary()
- drop "set" postfix from names, so "insert" can now take a vector of positions
- deprecate all the "_raw" variants, not really necessary now
25/3/09 started 7.18.0
- revised version numbers

22
TODO
View File

@ -1,21 +1,12 @@
- vips.c should drop "set" suffix from operators
- poor SMP scaling in benchmark
kernel changes? benchmark an old version
avg is different? used to 120.134, now 120.151
- _raw() variants should be deprecated?
- look through more sections for stuff in the wrong place
- more stuff from util.c? too much to do it all now
- maybe im_insertplaceset() should be im_insertset()? it's not an inplace
operator now
- like _vec(), remove set() from the ends of operator names in C++
- load 500 jpegs, shrink, save
- load 500 jpegs, group, shrink, save
VM use is huge, ouch, could we use a bit less?
@ -26,15 +17,10 @@
- VipsFormat next? where should we document the im_vip2jpeg() options?
- constant images:
we make them with im_black(), then m_lintra(), then im_clip(). How
about instead making a 1x1 pixel image and expanding it with im_emed()
about instead making a 1x1 pixel image and expanding with im_embed()
would this be quicker?
test wth nip2

View File

@ -100,38 +100,6 @@ static im_function contrast_surface_desc = {
contrast_surface_args /* Arg list */
};
/* Args to im_contrast_surface_raw.
*/
static im_arg_desc contrast_surface_raw_args[] = {
IM_INPUT_IMAGE( "in" ),
IM_OUTPUT_IMAGE( "out" ),
IM_INPUT_INT( "half_win_size" ),
IM_INPUT_INT( "spacing" )
};
/* Call im_contrast_surface_raw via arg vector.
*/
static int
contrast_surface_raw_vec( im_object *argv )
{
int half_win_size = *((int *) argv[2]);
int spacing = *((int *) argv[3]);
return( im_contrast_surface_raw( argv[0], argv[1],
half_win_size, spacing ) );
}
/* Description of im_contrast_surface_raw.
*/
static im_function contrast_surface_raw_desc = {
"im_contrast_surface_raw", /* Name */
"find high-contrast points in an image",
IM_FN_PIO, /* Flags */
contrast_surface_raw_vec, /* Dispatch function */
IM_NUMBER( contrast_surface_raw_args ),/* Size of arg list */
contrast_surface_raw_args /* Arg list */
};
/* Args to im_sharpen.
*/
static im_arg_desc sharpen_args[] = {
@ -229,27 +197,6 @@ static im_function conv_desc = {
conv_imask /* Arg list */
};
/* Call im_conv_raw via arg vector.
*/
static int
conv_raw_vec( im_object *argv )
{
im_mask_object *mo = argv[2];
return( im_conv_raw( argv[0], argv[1], mo->mask ) );
}
/* Description of im_conv_raw.
*/
static im_function conv_raw_desc = {
"im_conv_raw", /* Name */
"convolve, no border",
IM_FN_TRANSFORM | IM_FN_PIO, /* Flags */
conv_raw_vec, /* Dispatch function */
IM_NUMBER( conv_imask ), /* Size of arg list */
conv_imask /* Arg list */
};
/* Call im_convf via arg vector.
*/
static int
@ -271,27 +218,6 @@ static im_function convf_desc = {
conv_dmask /* Arg list */
};
/* Call im_convf_raw via arg vector.
*/
static int
convf_raw_vec( im_object *argv )
{
im_mask_object *mo = argv[2];
return( im_convf_raw( argv[0], argv[1], mo->mask ) );
}
/* Description of im_convf_raw.
*/
static im_function convf_raw_desc = {
"im_convf_raw", /* Name */
"convolve, with DOUBLEMASK, no border",
IM_FN_TRANSFORM | IM_FN_PIO, /* Flags */
convf_raw_vec, /* Dispatch function */
IM_NUMBER( conv_dmask ), /* Size of arg list */
conv_dmask /* Arg list */
};
/* Call im_convsep via arg vector.
*/
static int
@ -313,27 +239,6 @@ static im_function convsep_desc = {
conv_imask /* Arg list */
};
/* Call im_convsep_raw via arg vector.
*/
static int
convsep_raw_vec( im_object *argv )
{
im_mask_object *mo = argv[2];
return( im_convsep_raw( argv[0], argv[1], mo->mask ) );
}
/* Description of im_convsep_raw.
*/
static im_function convsep_raw_desc = {
"im_convsep_raw", /* Name */
"seperable convolution, no border",
IM_FN_TRANSFORM | IM_FN_PIO, /* Flags */
convsep_raw_vec, /* Dispatch function */
IM_NUMBER( conv_imask ), /* Size of arg list */
conv_imask /* Arg list */
};
/* Call im_convsepf via arg vector.
*/
static int
@ -355,27 +260,6 @@ static im_function convsepf_desc = {
conv_dmask /* Arg list */
};
/* Call im_convsepf_raw via arg vector.
*/
static int
convsepf_raw_vec( im_object *argv )
{
im_mask_object *mo = argv[2];
return( im_convsepf_raw( argv[0], argv[1], mo->mask ) );
}
/* Description of im_convsepf_raw.
*/
static im_function convsepf_raw_desc = {
"im_convsepf_raw", /* Name */
"seperable convolution, with DOUBLEMASK, no border",
IM_FN_PIO | IM_FN_TRANSFORM, /* Flags */
convsepf_raw_vec, /* Dispatch function */
IM_NUMBER( conv_dmask ), /* Size of arg list */
conv_dmask /* Arg list */
};
/* Call im_fastcor via arg vector.
*/
static int
@ -395,25 +279,6 @@ static im_function fastcor_desc = {
two_in_one_out /* Arg list */
};
/* Call im_fastcor_raw via arg vector.
*/
static int
fastcor_raw_vec( im_object *argv )
{
return( im_fastcor_raw( argv[0], argv[1], argv[2] ) );
}
/* Description of im_fastcor_raw.
*/
static im_function fastcor_raw_desc = {
"im_fastcor_raw", /* Name */
"fast correlate in2 within in1, no border",
IM_FN_TRANSFORM | IM_FN_PIO, /* Flags */
fastcor_raw_vec, /* Dispatch function */
IM_NUMBER( two_in_one_out ), /* Size of arg list */
two_in_one_out /* Arg list */
};
/* Call im_grad_x via arg vector.
*/
static int
@ -471,25 +336,6 @@ static im_function gradcor_desc = {
two_in_one_out /* Arg list */
};
/* Call im_gradcor_raw via arg vector.
*/
static int
gradcor_raw_vec( im_object *argv )
{
return( im_gradcor_raw( argv[0], argv[1], argv[2] ) );
}
/* Description of im_gradcor_raw.
*/
static im_function gradcor_raw_desc = {
"im_gradcor_raw", /* Name */
"non-normalised correlation of gradient of in2 within in1, no padding",
IM_FN_PIO | IM_FN_TRANSFORM, /* Flags */
gradcor_raw_vec, /* Dispatch function */
IM_NUMBER( two_in_one_out ), /* Size of arg list */
two_in_one_out /* Arg list */
};
/* Call im_gradient via arg vector.
*/
static int
@ -551,50 +397,23 @@ static im_function spcor_desc = {
two_in_one_out /* Arg list */
};
/* Call im_spcor_raw via arg vector.
*/
static int
spcor_raw_vec( im_object *argv )
{
return( im_spcor_raw( argv[0], argv[1], argv[2] ) );
}
/* Description of im_spcor_raw.
*/
static im_function spcor_raw_desc = {
"im_spcor_raw", /* Name */
"normalised correlation of in2 within in1, no black padding",
IM_FN_PIO | IM_FN_TRANSFORM, /* Flags */
spcor_raw_vec, /* Dispatch function */
IM_NUMBER( two_in_one_out ), /* Size of arg list */
two_in_one_out /* Arg list */
};
/* Package up all these functions.
*/
static im_function *convol_list[] = {
&compass_desc,
&contrast_surface_desc,
&contrast_surface_raw_desc,
&conv_desc,
&convf_desc,
&convf_raw_desc,
&conv_raw_desc,
&convsep_desc,
&convsepf_desc,
&convsepf_raw_desc,
&convsep_raw_desc,
&fastcor_desc,
&fastcor_raw_desc,
&gradcor_desc,
&gradcor_raw_desc,
&gradient_desc,
&grad_x_desc,
&grad_y_desc,
&lindetect_desc,
&sharpen_desc,
&spcor_desc,
&spcor_raw_desc
};
/* Package of functions.

View File

@ -474,114 +474,3 @@ im_conv( IMAGE *in, IMAGE *out, INTMASK *mask )
return( 0 );
}
/* im__create_int_luts is not used in this file. We have to keep it for the use
* of other conv functions in this directory which have not yet been
* rewritten.
FIXME ... the only one left is im_convsub() which I'm sure no one
uses. Scrap this junk in the next version. Kill off the old gradient
and lindetect things too.
*/
/* Create multiplication luts for all non zero elements of the original mask;
* which is kept in buffer of length buffersize
* cnt is needed for freeing luts
*/
int
im__create_int_luts( int *buffer, int buffersize,
int **orig_luts, int **luts, int *cnt )
{
int *pbuffer;
int *buf1, *buf2, *pbuf1, *pbuf2;
int i, j;
int min, max;
int mark; /* used to mark the buffer mark = max+1 */
int counter; /* counts the no of unique elms in mask; returned in cnt*/
buf1 = (int*)calloc( (unsigned)buffersize, sizeof(int) );
buf2 = (int*)calloc( (unsigned)buffersize, sizeof(int) );
if ( ( buf1 == NULL ) || ( buf2 == NULL ) )
{
im_error( "im_create_int_luts", "%s", _( "calloc failed (1)") );
return( -1 );
}
pbuffer = buffer;
pbuf1 = buf1;
/* find max and copy mask to buf1 */
max = *pbuffer;
for ( i=0; i < buffersize; i++ )
{
if ( *pbuffer > max )
max = *pbuffer;
*pbuf1++ = *pbuffer++;
}
mark = max + 1;
pbuf1 = buf1;
pbuf2 = buf2;
counter = 0;
/* find a min at a time; put it into buf2 and mark all values of
* buf1 equal to found min, to INT_MAX
*/
for ( i=0; i < buffersize; i++ )
{
min = mark + 1; /* force min to be greater than mark */
pbuf1 = buf1;
/* find a min */
for ( j=0; j < buffersize; j++ )
{
if ( *pbuf1 < min )
min = *pbuf1;
pbuf1++;
}
if ( min == mark ) /* all min are found */
break;
*pbuf2++ = min;
counter++;
pbuf1 = buf1;
for ( j=0; j < buffersize; j++ ) /* mark values equal to min */
{
if ( *pbuf1 == min )
*pbuf1 = mark;
pbuf1++;
}
}
/* buf2 should keep now counter unique values of the mask, descending order
* Malloc counter luts and initialise them
*/
pbuf2 = buf2;
for ( i=0; i<counter; i++)
{
orig_luts[i] = (int*)calloc((unsigned)256, sizeof(int));
if (orig_luts[i] == NULL)
{
im_error( "im_create_int_luts", "%s", _( "calloc failed (2)") );
return( -1 );
}
for ( j=0; j<256; j++ )
*(orig_luts[i] + j) = j * (*pbuf2);
pbuf2++;
}
pbuffer = buffer;
for ( i=0; i<buffersize; i++ )
{
j = 0;
while ( 1 )
{
if ( *(buf2 + j) == *pbuffer )
{
luts[i] = orig_luts[j];
break;
}
j++;
}
pbuffer++;
}
/* free buf1, buf2 */
free((char*)buf1); free( (char*)buf2);
*cnt = counter;
return(0);
}

View File

@ -106,27 +106,6 @@ YGRAD_GEN_DECLARATION( double );
/** EXPORTED FUNCTION DEFINITIONS **/
int
im_gradcor( IMAGE *in, IMAGE *ref, IMAGE *out )
{
#define FUNCTION_NAME "im_gradcor"
IMAGE *t1 = im_open_local( out, FUNCTION_NAME " intermediate", "p" );
if( !t1 ||
im_embed( in, t1, 1,
ref->Xsize / 2, ref->Ysize / 2,
in->Xsize + ref->Xsize - 1,
in->Ysize + ref->Ysize - 1 ) ||
im_gradcor_raw( t1, ref, out ) )
return( -1 );
out->Xoffset = 0;
out->Yoffset = 0;
return( 0 );
#undef FUNCTION_NAME
}
int im_gradcor_raw( IMAGE *large, IMAGE *small, IMAGE *out ){
#define FUNCTION_NAME "im_gradcor_raw"
@ -173,6 +152,27 @@ int im_gradcor_raw( IMAGE *large, IMAGE *small, IMAGE *out ){
#undef FUNCTION_NAME
}
int
im_gradcor( IMAGE *in, IMAGE *ref, IMAGE *out )
{
#define FUNCTION_NAME "im_gradcor"
IMAGE *t1 = im_open_local( out, FUNCTION_NAME " intermediate", "p" );
if( !t1 ||
im_embed( in, t1, 1,
ref->Xsize / 2, ref->Ysize / 2,
in->Xsize + ref->Xsize - 1,
in->Ysize + ref->Ysize - 1 ) ||
im_gradcor_raw( t1, ref, out ) )
return( -1 );
out->Xoffset = 0;
out->Yoffset = 0;
return( 0 );
#undef FUNCTION_NAME
}
int im_grad_x( IMAGE *in, IMAGE *out ){
#define FUNCTION_NAME "im_grad_x"

View File

@ -41,6 +41,62 @@
#include <dmalloc.h>
#endif /*WITH_DMALLOC*/
/* Args for im_lhisteq.
*/
static im_arg_desc lhisteq_args[] = {
IM_INPUT_IMAGE( "in" ),
IM_OUTPUT_IMAGE( "out" ),
IM_INPUT_INT( "width" ),
IM_INPUT_INT( "height" )
};
/* Args for im_stdif.
*/
static im_arg_desc stdif_args[] = {
IM_INPUT_IMAGE( "in" ),
IM_OUTPUT_IMAGE( "out" ),
IM_INPUT_DOUBLE( "a" ),
IM_INPUT_DOUBLE( "m0" ),
IM_INPUT_DOUBLE( "b" ),
IM_INPUT_DOUBLE( "s0" ),
IM_INPUT_INT( "xw" ),
IM_INPUT_INT( "yw" )
};
/* Args to im_erode.
*/
static im_arg_desc erode_args[] = {
IM_INPUT_IMAGE( "in" ),
IM_OUTPUT_IMAGE( "out" ),
IM_INPUT_IMASK( "mask" )
};
/* Args to im_rank.
*/
static im_arg_desc rank_args[] = {
IM_INPUT_IMAGE( "in" ),
IM_OUTPUT_IMAGE( "out" ),
IM_INPUT_INT( "xsize" ),
IM_INPUT_INT( "ysize" ),
IM_INPUT_INT( "n" )
};
/* Args for convolver with imask.
*/
static im_arg_desc conv_imask[] = {
IM_INPUT_IMAGE( "in" ),
IM_OUTPUT_IMAGE( "out" ),
IM_INPUT_IMASK( "matrix" )
};
/* Args for convolver with dmask.
*/
static im_arg_desc conv_dmask[] = {
IM_INPUT_IMAGE( "in" ),
IM_OUTPUT_IMAGE( "out" ),
IM_INPUT_DMASK( "matrix" )
};
/* One image in, one out.
*/
static im_arg_desc one_in_one_out[] = {
@ -826,6 +882,292 @@ static im_function insertplaceset_desc = {
insertplaceset_args /* Arg list */
};
/* Call im_spcor_raw via arg vector.
*/
static int
spcor_raw_vec( im_object *argv )
{
return( im_spcor_raw( argv[0], argv[1], argv[2] ) );
}
/* Description of im_spcor_raw.
*/
static im_function spcor_raw_desc = {
"im_spcor_raw", /* Name */
"normalised correlation of in2 within in1, no black padding",
IM_FN_PIO | IM_FN_TRANSFORM, /* Flags */
spcor_raw_vec, /* Dispatch function */
IM_NUMBER( two_in_one_out ), /* Size of arg list */
two_in_one_out /* Arg list */
};
/* Call im_gradcor_raw via arg vector.
*/
static int
gradcor_raw_vec( im_object *argv )
{
return( im_gradcor_raw( argv[0], argv[1], argv[2] ) );
}
/* Description of im_gradcor_raw.
*/
static im_function gradcor_raw_desc = {
"im_gradcor_raw", /* Name */
"non-normalised correlation of gradient of in2 within in1, no padding",
IM_FN_PIO | IM_FN_TRANSFORM, /* Flags */
gradcor_raw_vec, /* Dispatch function */
IM_NUMBER( two_in_one_out ), /* Size of arg list */
two_in_one_out /* Arg list */
};
/* Call im_fastcor_raw via arg vector.
*/
static int
fastcor_raw_vec( im_object *argv )
{
return( im_fastcor_raw( argv[0], argv[1], argv[2] ) );
}
/* Description of im_fastcor_raw.
*/
static im_function fastcor_raw_desc = {
"im_fastcor_raw", /* Name */
"fast correlate in2 within in1, no border",
IM_FN_TRANSFORM | IM_FN_PIO, /* Flags */
fastcor_raw_vec, /* Dispatch function */
IM_NUMBER( two_in_one_out ), /* Size of arg list */
two_in_one_out /* Arg list */
};
/* Call im_convsepf_raw via arg vector.
*/
static int
convsepf_raw_vec( im_object *argv )
{
im_mask_object *mo = argv[2];
return( im_convsepf_raw( argv[0], argv[1], mo->mask ) );
}
/* Description of im_convsepf_raw.
*/
static im_function convsepf_raw_desc = {
"im_convsepf_raw", /* Name */
"seperable convolution, with DOUBLEMASK, no border",
IM_FN_PIO | IM_FN_TRANSFORM, /* Flags */
convsepf_raw_vec, /* Dispatch function */
IM_NUMBER( conv_dmask ), /* Size of arg list */
conv_dmask /* Arg list */
};
/* Call im_convsep_raw via arg vector.
*/
static int
convsep_raw_vec( im_object *argv )
{
im_mask_object *mo = argv[2];
return( im_convsep_raw( argv[0], argv[1], mo->mask ) );
}
/* Description of im_convsep_raw.
*/
static im_function convsep_raw_desc = {
"im_convsep_raw", /* Name */
"seperable convolution, no border",
IM_FN_TRANSFORM | IM_FN_PIO, /* Flags */
convsep_raw_vec, /* Dispatch function */
IM_NUMBER( conv_imask ), /* Size of arg list */
conv_imask /* Arg list */
};
/* Call im_convf_raw via arg vector.
*/
static int
convf_raw_vec( im_object *argv )
{
im_mask_object *mo = argv[2];
return( im_convf_raw( argv[0], argv[1], mo->mask ) );
}
/* Description of im_convf_raw.
*/
static im_function convf_raw_desc = {
"im_convf_raw", /* Name */
"convolve, with DOUBLEMASK, no border",
IM_FN_TRANSFORM | IM_FN_PIO, /* Flags */
convf_raw_vec, /* Dispatch function */
IM_NUMBER( conv_dmask ), /* Size of arg list */
conv_dmask /* Arg list */
};
/* Call im_conv_raw via arg vector.
*/
static int
conv_raw_vec( im_object *argv )
{
im_mask_object *mo = argv[2];
return( im_conv_raw( argv[0], argv[1], mo->mask ) );
}
/* Description of im_conv_raw.
*/
static im_function conv_raw_desc = {
"im_conv_raw", /* Name */
"convolve, no border",
IM_FN_TRANSFORM | IM_FN_PIO, /* Flags */
conv_raw_vec, /* Dispatch function */
IM_NUMBER( conv_imask ), /* Size of arg list */
conv_imask /* Arg list */
};
/* Args to im_contrast_surface_raw.
*/
static im_arg_desc contrast_surface_raw_args[] = {
IM_INPUT_IMAGE( "in" ),
IM_OUTPUT_IMAGE( "out" ),
IM_INPUT_INT( "half_win_size" ),
IM_INPUT_INT( "spacing" )
};
/* Call im_contrast_surface_raw via arg vector.
*/
static int
contrast_surface_raw_vec( im_object *argv )
{
int half_win_size = *((int *) argv[2]);
int spacing = *((int *) argv[3]);
return( im_contrast_surface_raw( argv[0], argv[1],
half_win_size, spacing ) );
}
/* Description of im_contrast_surface_raw.
*/
static im_function contrast_surface_raw_desc = {
"im_contrast_surface_raw", /* Name */
"find high-contrast points in an image",
IM_FN_PIO, /* Flags */
contrast_surface_raw_vec, /* Dispatch function */
IM_NUMBER( contrast_surface_raw_args ),/* Size of arg list */
contrast_surface_raw_args /* Arg list */
};
/* Call im_stdif_raw via arg vector.
*/
static int
stdif_raw_vec( im_object *argv )
{
double a = *((double *) argv[2]);
double m0 = *((double *) argv[3]);
double b = *((double *) argv[4]);
double s0 = *((double *) argv[5]);
int xw = *((int *) argv[6]);
int yw = *((int *) argv[7]);
return( im_stdif_raw( argv[0], argv[1], a, m0, b, s0, xw, yw ) );
}
/* Description of im_stdif.
*/
static im_function stdif_raw_desc = {
"im_stdif_raw", /* Name */
"statistical differencing, no border",
IM_FN_PIO, /* Flags */
stdif_raw_vec, /* Dispatch function */
IM_NUMBER( stdif_args ), /* Size of arg list */
stdif_args /* Arg list */
};
/* Call im_lhisteq_raw via arg vector.
*/
static int
lhisteq_raw_vec( im_object *argv )
{
int xw = *((int *) argv[2]);
int yw = *((int *) argv[3]);
return( im_lhisteq_raw( argv[0], argv[1], xw, yw ) );
}
/* Description of im_lhisteq_raw.
*/
static im_function lhisteq_raw_desc = {
"im_lhisteq_raw", /* Name */
"local histogram equalisation, no border",
IM_FN_PIO, /* Flags */
lhisteq_raw_vec, /* Dispatch function */
IM_NUMBER( lhisteq_args ), /* Size of arg list */
lhisteq_args /* Arg list */
};
/* Call im_rank_raw via arg vector.
*/
static int
rank_raw_vec( im_object *argv )
{
int xsize = *((int *) argv[2]);
int ysize = *((int *) argv[3]);
int n = *((int *) argv[4]);
return( im_rank_raw( argv[0], argv[1], xsize, ysize, n ) );
}
/* Description of im_rank_raw.
*/
static im_function rank_raw_desc = {
"im_rank_raw", /* Name */
"rank filter nth element of xsize/ysize window, no border",
IM_FN_PIO, /* Flags */
rank_raw_vec, /* Dispatch function */
IM_NUMBER( rank_args ), /* Size of arg list */
rank_args /* Arg list */
};
/* Call im_erode_raw via arg vector.
*/
static int
erode_raw_vec( im_object *argv )
{
im_mask_object *mo = argv[2];
return( im_erode_raw( argv[0], argv[1], mo->mask ) );
}
/* Description of im_erode_raw.
*/
static im_function erode_raw_desc = {
"im_erode_raw", /* Name */
"erode image with mask",
IM_FN_PIO | IM_FN_TRANSFORM, /* Flags */
erode_raw_vec, /* Dispatch function */
IM_NUMBER( erode_args ), /* Size of arg list */
erode_args /* Arg list */
};
/* Call im_dilate_raw via arg vector.
*/
static int
dilate_raw_vec( im_object *argv )
{
im_mask_object *mo = argv[2];
return( im_dilate_raw( argv[0], argv[1], mo->mask ) );
}
/* Description of im_dilate_raw.
*/
static im_function dilate_raw_desc = {
"im_dilate_raw", /* Name */
"dilate image with mask",
IM_FN_PIO | IM_FN_TRANSFORM, /* Flags */
dilate_raw_vec, /* Dispatch function */
IM_NUMBER( erode_args ), /* Size of arg list */
erode_args /* Arg list */
};
/* Package up all these functions.
*/
static im_function *deprecated_list[] = {
@ -854,6 +1196,19 @@ static im_function *deprecated_list[] = {
&segment_desc,
&line_desc,
&thresh_desc,
&convf_raw_desc,
&conv_raw_desc,
&contrast_surface_raw_desc,
&convsepf_raw_desc,
&convsep_raw_desc,
&fastcor_raw_desc,
&gradcor_raw_desc,
&spcor_raw_desc,
&lhisteq_raw_desc,
&stdif_raw_desc,
&rank_raw_desc,
&dilate_raw_desc,
&erode_raw_desc,
&similarity_area_desc,
&similarity_desc
};

View File

@ -60,6 +60,107 @@
#include <dmalloc.h>
#endif /*WITH_DMALLOC*/
/* Create multiplication luts for all non zero elements of the original mask;
* which is kept in buffer of length buffersize
* cnt is needed for freeing luts
*/
static int
im__create_int_luts( int *buffer, int buffersize,
int **orig_luts, int **luts, int *cnt )
{
int *pbuffer;
int *buf1, *buf2, *pbuf1, *pbuf2;
int i, j;
int min, max;
int mark; /* used to mark the buffer mark = max+1 */
int counter; /* counts the no of unique elms in mask; returned in cnt*/
buf1 = (int*)calloc( (unsigned)buffersize, sizeof(int) );
buf2 = (int*)calloc( (unsigned)buffersize, sizeof(int) );
if ( ( buf1 == NULL ) || ( buf2 == NULL ) )
{
im_error( "im_create_int_luts", "%s", _( "calloc failed (1)") );
return( -1 );
}
pbuffer = buffer;
pbuf1 = buf1;
/* find max and copy mask to buf1 */
max = *pbuffer;
for ( i=0; i < buffersize; i++ )
{
if ( *pbuffer > max )
max = *pbuffer;
*pbuf1++ = *pbuffer++;
}
mark = max + 1;
pbuf1 = buf1;
pbuf2 = buf2;
counter = 0;
/* find a min at a time; put it into buf2 and mark all values of
* buf1 equal to found min, to INT_MAX
*/
for ( i=0; i < buffersize; i++ )
{
min = mark + 1; /* force min to be greater than mark */
pbuf1 = buf1;
/* find a min */
for ( j=0; j < buffersize; j++ )
{
if ( *pbuf1 < min )
min = *pbuf1;
pbuf1++;
}
if ( min == mark ) /* all min are found */
break;
*pbuf2++ = min;
counter++;
pbuf1 = buf1;
for ( j=0; j < buffersize; j++ ) /* mark values equal to min */
{
if ( *pbuf1 == min )
*pbuf1 = mark;
pbuf1++;
}
}
/* buf2 should keep now counter unique values of the mask, descending order
* Malloc counter luts and initialise them
*/
pbuf2 = buf2;
for ( i=0; i<counter; i++)
{
orig_luts[i] = (int*)calloc((unsigned)256, sizeof(int));
if (orig_luts[i] == NULL)
{
im_error( "im_create_int_luts", "%s", _( "calloc failed (2)") );
return( -1 );
}
for ( j=0; j<256; j++ )
*(orig_luts[i] + j) = j * (*pbuf2);
pbuf2++;
}
pbuffer = buffer;
for ( i=0; i<buffersize; i++ )
{
j = 0;
while ( 1 )
{
if ( *(buf2 + j) == *pbuffer )
{
luts[i] = orig_luts[j];
break;
}
j++;
}
pbuffer++;
}
/* free buf1, buf2 */
free((char*)buf1); free( (char*)buf2);
*cnt = counter;
return(0);
}
int im_convsub( in, out, m, xskip, yskip )
IMAGE *in, *out;

View File

@ -423,28 +423,6 @@ static im_function lhisteq_desc = {
lhisteq_args /* Arg list */
};
/* Call im_lhisteq_raw via arg vector.
*/
static int
lhisteq_raw_vec( im_object *argv )
{
int xw = *((int *) argv[2]);
int yw = *((int *) argv[3]);
return( im_lhisteq_raw( argv[0], argv[1], xw, yw ) );
}
/* Description of im_lhisteq_raw.
*/
static im_function lhisteq_raw_desc = {
"im_lhisteq_raw", /* Name */
"local histogram equalisation, no border",
IM_FN_PIO, /* Flags */
lhisteq_raw_vec, /* Dispatch function */
IM_NUMBER( lhisteq_args ), /* Size of arg list */
lhisteq_args /* Arg list */
};
/* Args for im_maplut.
*/
static im_arg_desc maplut_args[] = {
@ -538,32 +516,6 @@ static im_function stdif_desc = {
stdif_args /* Arg list */
};
/* Call im_stdif_raw via arg vector.
*/
static int
stdif_raw_vec( im_object *argv )
{
double a = *((double *) argv[2]);
double m0 = *((double *) argv[3]);
double b = *((double *) argv[4]);
double s0 = *((double *) argv[5]);
int xw = *((int *) argv[6]);
int yw = *((int *) argv[7]);
return( im_stdif_raw( argv[0], argv[1], a, m0, b, s0, xw, yw ) );
}
/* Description of im_stdif.
*/
static im_function stdif_raw_desc = {
"im_stdif_raw", /* Name */
"statistical differencing, no border",
IM_FN_PIO, /* Flags */
stdif_raw_vec, /* Dispatch function */
IM_NUMBER( stdif_args ), /* Size of arg list */
stdif_args /* Arg list */
};
/* Args for im_buildlut.
*/
static im_arg_desc buildlut_args[] = {
@ -854,13 +806,11 @@ static im_function *hist_list[] = {
&ismonotonic_desc,
&lhisteq_desc,
&mpercent_desc,
&lhisteq_raw_desc,
&invertlut_desc,
&buildlut_desc,
&maplut_desc,
&project_desc,
&stdif_desc,
&stdif_raw_desc,
&tone_analyse_desc,
&tone_build_desc,
&tone_build_range_desc,

View File

@ -38,13 +38,9 @@ extern "C" {
#endif /*__cplusplus*/
int im_conv( IMAGE *in, IMAGE *out, INTMASK *mask );
int im_conv_raw( IMAGE *in, IMAGE *out, INTMASK *mask );
int im_convf( IMAGE *in, IMAGE *out, DOUBLEMASK *mask );
int im_convf_raw( IMAGE *in, IMAGE *out, DOUBLEMASK *mask );
int im_convsep( IMAGE *in, IMAGE *out, INTMASK *mask );
int im_convsep_raw( IMAGE *in, IMAGE *out, INTMASK *mask );
int im_convsepf( IMAGE *in, IMAGE *out, DOUBLEMASK *mask );
int im_convsepf_raw( IMAGE *in, IMAGE *out, DOUBLEMASK *mask );
int im_compass( IMAGE *in, IMAGE *out, INTMASK *mask );
int im_gradient( IMAGE *in, IMAGE *out, INTMASK *mask );
@ -59,15 +55,10 @@ int im_grad_x( IMAGE *in, IMAGE *out );
int im_grad_y( IMAGE *in, IMAGE *out );
int im_fastcor( IMAGE *in, IMAGE *ref, IMAGE *out );
int im_fastcor_raw( IMAGE *in, IMAGE *ref, IMAGE *out );
int im_spcor( IMAGE *in, IMAGE *ref, IMAGE *out );
int im_spcor_raw( IMAGE *in, IMAGE *ref, IMAGE *out );
int im_gradcor( IMAGE *in, IMAGE *ref, IMAGE *out );
int im_gradcor_raw( IMAGE *in, IMAGE *ref, IMAGE *out );
int im_contrast_surface( IMAGE *in, IMAGE *out,
int half_win_size, int spacing );
int im_contrast_surface_raw( IMAGE *in, IMAGE *out,
int half_win_size, int spacing );
#ifdef __cplusplus
}

View File

@ -352,6 +352,24 @@ int im_resize_linear( IMAGE *, IMAGE *, int, int );
int im_line( IMAGE *, int, int, int, int, int );
int im_segment( IMAGE *test, IMAGE *mask, int *segments );
int im_conv_raw( IMAGE *in, IMAGE *out, INTMASK *mask );
int im_convf_raw( IMAGE *in, IMAGE *out, DOUBLEMASK *mask );
int im_convsep_raw( IMAGE *in, IMAGE *out, INTMASK *mask );
int im_convsepf_raw( IMAGE *in, IMAGE *out, DOUBLEMASK *mask );
int im_fastcor_raw( IMAGE *in, IMAGE *ref, IMAGE *out );
int im_spcor_raw( IMAGE *in, IMAGE *ref, IMAGE *out );
int im_gradcor_raw( IMAGE *in, IMAGE *ref, IMAGE *out );
int im_contrast_surface_raw( IMAGE *in, IMAGE *out,
int half_win_size, int spacing );
int im_stdif_raw( IMAGE *in, IMAGE *out,
double a, double m0, double b, double s0, int xwin, int ywin );
int im_lhisteq_raw( IMAGE *in, IMAGE *out, int xwin, int ywin );
int im_erode_raw( IMAGE *in, IMAGE *out, INTMASK *m );
int im_dilate_raw( IMAGE *in, IMAGE *out, INTMASK *m );
int im_rank_raw( IMAGE *in, IMAGE *out, int xsize, int ysize, int order );
#ifdef __cplusplus
}
#endif /*__cplusplus*/

View File

@ -53,13 +53,10 @@ int im_hsp( IMAGE *in, IMAGE *ref, IMAGE *out );
int im_identity( IMAGE *lut, int bands );
int im_identity_ushort( IMAGE *lut, int bands, int sz );
int im_lhisteq( IMAGE *in, IMAGE *out, int xwin, int ywin );
int im_lhisteq_raw( IMAGE *in, IMAGE *out, int xwin, int ywin );
int im_invertlut( DOUBLEMASK *input, IMAGE *output, int lut_size );
int im_buildlut( DOUBLEMASK *input, IMAGE *output );
int im_stdif( IMAGE *in, IMAGE *out,
double a, double m0, double b, double s0, int xwin, int ywin );
int im_stdif_raw( IMAGE *in, IMAGE *out,
double a, double m0, double b, double s0, int xwin, int ywin );
int im_tone_build_range( IMAGE *out,
int in_max, int out_max,
double Lb, double Lw, double Ps, double Pm, double Ph,

View File

@ -181,8 +181,6 @@ void im__print_one( int );
int im__trigger_callbacks( GSList *cblist );
int im__close( IMAGE * );
int im__handle_eval( IMAGE *im, int w, int h );
int im__create_int_luts( int *, int, int **, int **, int * );
int im__create_double_luts( double *, int, double **, double **, int * );
int im__fft_sp( float *rvec, float *ivec, int logrows, int logcols );
int im__fftproc( IMAGE *dummy, IMAGE *in, IMAGE *out, im__fftproc_fn fn );
int im__mean_std_double_buffer( double *buffer, int size,

View File

@ -38,12 +38,9 @@ extern "C" {
#endif /*__cplusplus*/
int im_dilate( IMAGE *in, IMAGE *out, INTMASK *m );
int im_dilate_raw( IMAGE *in, IMAGE *out, INTMASK *m );
int im_erode( IMAGE *in, IMAGE *out, INTMASK *m );
int im_erode_raw( IMAGE *in, IMAGE *out, INTMASK *m );
int im_rank( IMAGE *in, IMAGE *out, int xsize, int ysize, int order );
int im_rank_raw( IMAGE *in, IMAGE *out, int xsize, int ysize, int order );
int im_rank_image( IMAGE **in, IMAGE *out, int n, int index );
int im_maxvalue( IMAGE **in, IMAGE *out, int n );

View File

@ -111,27 +111,6 @@ static im_function dilate_desc = {
erode_args /* Arg list */
};
/* Call im_dilate_raw via arg vector.
*/
static int
dilate_raw_vec( im_object *argv )
{
im_mask_object *mo = argv[2];
return( im_dilate_raw( argv[0], argv[1], mo->mask ) );
}
/* Description of im_dilate_raw.
*/
static im_function dilate_raw_desc = {
"im_dilate_raw", /* Name */
"dilate image with mask",
IM_FN_PIO | IM_FN_TRANSFORM, /* Flags */
dilate_raw_vec, /* Dispatch function */
IM_NUMBER( erode_args ), /* Size of arg list */
erode_args /* Arg list */
};
/* Call im_erode via arg vector.
*/
static int
@ -153,27 +132,6 @@ static im_function erode_desc = {
erode_args /* Arg list */
};
/* Call im_erode_raw via arg vector.
*/
static int
erode_raw_vec( im_object *argv )
{
im_mask_object *mo = argv[2];
return( im_erode_raw( argv[0], argv[1], mo->mask ) );
}
/* Description of im_erode_raw.
*/
static im_function erode_raw_desc = {
"im_erode_raw", /* Name */
"erode image with mask",
IM_FN_PIO | IM_FN_TRANSFORM, /* Flags */
erode_raw_vec, /* Dispatch function */
IM_NUMBER( erode_args ), /* Size of arg list */
erode_args /* Arg list */
};
/* Args to im_cntlines.
*/
static im_arg_desc cntlines_args[] = {
@ -312,29 +270,6 @@ static im_function rank_image_desc = {
rank_image_args /* Arg list */
};
/* Call im_rank_raw via arg vector.
*/
static int
rank_raw_vec( im_object *argv )
{
int xsize = *((int *) argv[2]);
int ysize = *((int *) argv[3]);
int n = *((int *) argv[4]);
return( im_rank_raw( argv[0], argv[1], xsize, ysize, n ) );
}
/* Description of im_rank_raw.
*/
static im_function rank_raw_desc = {
"im_rank_raw", /* Name */
"rank filter nth element of xsize/ysize window, no border",
IM_FN_PIO, /* Flags */
rank_raw_vec, /* Dispatch function */
IM_NUMBER( rank_args ), /* Size of arg list */
rank_args /* Arg list */
};
/* Args for im_label_regions().
*/
static im_arg_desc label_regions_args[] = {
@ -376,10 +311,7 @@ static im_function *morph_list[] = {
&maxvalue_desc,
&label_regions_desc,
&zerox_desc,
&rank_raw_desc,
&dilate_raw_desc,
&erode_desc,
&erode_raw_desc,
&profile_desc
};