small fixes

This commit is contained in:
John Cupitt 2011-11-17 14:43:08 +00:00
parent a4d9385408
commit 4256563332
7 changed files with 147 additions and 109 deletions

21
TODO
View File

@ -8,8 +8,29 @@
rewrite im_bandmean() in terms of recomb()? just use [0.33, 0.33, 0.33]
no, bandmean is OK, just move to conversion
move im_point_bilinear() to deprecated? or convenience?
can we document several classes in one gtk-doc page? doesn't look like it
argh
our choice is then just document the C API, which means making the C wrapper
mandatory, or to make a separate header for every operation
why doesn't vips_add() appear in the docs? curious
try
$ vips join
... usage ...
join: too few arguments
VipsObject: parameter in1 to VipsJoin not set
VipsObject: parameter in2 to VipsJoin not set
VipsObject: parameter direction to VipsJoin not set
why do we have four errors? shouldn't we stop after the first one?
- try an area operation, like conv, VipsArea? oops no haha what name should we

View File

@ -22,7 +22,6 @@
<xi:include href="xml/generate.xml"/>
<xi:include href="xml/header.xml"/>
<xi:include href="xml/operation.xml"/>
<xi:include href="xml/pool.xml"/>
<xi:include href="xml/rect.xml"/>
<xi:include href="xml/threadpool.xml"/>
<xi:include href="xml/object.xml"/>
@ -34,8 +33,6 @@
<chapter>
<title>VIPS operation API by section</title>
<xi:include href="xml/arithmetic.xml"/>
<xi:include href="xml/boolean.xml"/>
<xi:include href="xml/relational.xml"/>
<xi:include href="xml/colour.xml"/>
<xi:include href="xml/conversion.xml"/>
<xi:include href="xml/convolution.xml"/>

View File

@ -81,90 +81,6 @@
#include "binary.h"
/**
* VipsAdd:
* @in1: input image
* @in2: input image
* @out: output image
*
* This operation calculates @in1 + @in2 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.
*
* If the number of bands differs, one of the images
* must have one band. In this case, an n-band image is formed from the
* one-band image by joining n copies of the one-band image together, and then
* the two n-band images are operated upon.
*
* The two input images are cast up to the smallest common type (see table
* Smallest common format in
* <link linkend="VIPS-arithmetic">arithmetic</link>), then the
* following table is used to determine the output type:
*
* <table>
* <title>VipsAdd type promotion</title>
* <tgroup cols='2' align='left' colsep='1' rowsep='1'>
* <thead>
* <row>
* <entry>input type</entry>
* <entry>output type</entry>
* </row>
* </thead>
* <tbody>
* <row>
* <entry>uchar</entry>
* <entry>ushort</entry>
* </row>
* <row>
* <entry>char</entry>
* <entry>short</entry>
* </row>
* <row>
* <entry>ushort</entry>
* <entry>uint</entry>
* </row>
* <row>
* <entry>short</entry>
* <entry>int</entry>
* </row>
* <row>
* <entry>uint</entry>
* <entry>uint</entry>
* </row>
* <row>
* <entry>int</entry>
* <entry>int</entry>
* </row>
* <row>
* <entry>float</entry>
* <entry>float</entry>
* </row>
* <row>
* <entry>double</entry>
* <entry>double</entry>
* </row>
* <row>
* <entry>complex</entry>
* <entry>complex</entry>
* </row>
* <row>
* <entry>double complex</entry>
* <entry>double complex</entry>
* </row>
* </tbody>
* </tgroup>
* </table>
*
* In other words, the output type is just large enough to hold the whole
* range of possible values.
*
* Operations on integer images are performed using the processor's vector unit,
* if possible. Disable this with --vips-novector or IM_NOVECTOR.
*
* See also: #VipsSubtract, #VipsLinear.
*/
typedef VipsBinary VipsAdd;
typedef VipsBinaryClass VipsAddClass;
@ -315,6 +231,90 @@ vips_add_init( VipsAdd *add )
{
}
/**
* vips_add:
* @left: input image
* @right: input image
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* This operation calculates @in1 + @in2 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.
*
* If the number of bands differs, one of the images
* must have one band. In this case, an n-band image is formed from the
* one-band image by joining n copies of the one-band image together, and then
* the two n-band images are operated upon.
*
* The two input images are cast up to the smallest common type (see table
* Smallest common format in
* <link linkend="VIPS-arithmetic">arithmetic</link>), then the
* following table is used to determine the output type:
*
* <table>
* <title>VipsAdd type promotion</title>
* <tgroup cols='2' align='left' colsep='1' rowsep='1'>
* <thead>
* <row>
* <entry>input type</entry>
* <entry>output type</entry>
* </row>
* </thead>
* <tbody>
* <row>
* <entry>uchar</entry>
* <entry>ushort</entry>
* </row>
* <row>
* <entry>char</entry>
* <entry>short</entry>
* </row>
* <row>
* <entry>ushort</entry>
* <entry>uint</entry>
* </row>
* <row>
* <entry>short</entry>
* <entry>int</entry>
* </row>
* <row>
* <entry>uint</entry>
* <entry>uint</entry>
* </row>
* <row>
* <entry>int</entry>
* <entry>int</entry>
* </row>
* <row>
* <entry>float</entry>
* <entry>float</entry>
* </row>
* <row>
* <entry>double</entry>
* <entry>double</entry>
* </row>
* <row>
* <entry>complex</entry>
* <entry>complex</entry>
* </row>
* <row>
* <entry>double complex</entry>
* <entry>double complex</entry>
* </row>
* </tbody>
* </tgroup>
* </table>
*
* In other words, the output type is just large enough to hold the whole
* range of possible values.
*
* Operations on integer images are performed using the processor's vector unit,
* if possible. Disable this with --vips-novector or IM_NOVECTOR.
*
* See also: vips_subtract(), vips_linear().
*/
int
vips_add( VipsImage *left, VipsImage *right, VipsImage **out, ... )
{

View File

@ -464,7 +464,7 @@ vips_arithmetic_compile( VipsArithmeticClass *class )
#ifdef DEBUG
printf( "vips_arithmetic_compile: " );
for( i = 0; i < IM_BANDFMT_LAST; i++ )
for( i = 0; i < VIPS_FORMAT_LAST; i++ )
if( class->vector_program[i] )
printf( "%s ",
VIPS_ENUM_NICK( VIPS_TYPE_BAND_FORMAT, i ) );

View File

@ -263,18 +263,28 @@ vips_max_scan( VipsStatistic *statistic, void *seq,
int i;
switch( vips_image_get_format( statistic->in ) ) {
case IM_BANDFMT_UCHAR: LOOPU( unsigned char, UCHAR_MAX ); break;
case IM_BANDFMT_CHAR: LOOPU( signed char, SCHAR_MAX ); break;
case IM_BANDFMT_USHORT: LOOPU( unsigned short, USHRT_MAX ); break;
case IM_BANDFMT_SHORT: LOOPU( signed short, SHRT_MAX ); break;
case IM_BANDFMT_UINT: LOOPU( unsigned int, UINT_MAX ); break;
case IM_BANDFMT_INT: LOOPU( signed int, INT_MAX ); break;
case VIPS_FORMAT_UCHAR:
LOOPU( unsigned char, UCHAR_MAX ); break;
case VIPS_FORMAT_CHAR:
LOOPU( signed char, SCHAR_MAX ); break;
case VIPS_FORMAT_USHORT:
LOOPU( unsigned short, USHRT_MAX ); break;
case VIPS_FORMAT_SHORT:
LOOPU( signed short, SHRT_MAX ); break;
case VIPS_FORMAT_UINT:
LOOPU( unsigned int, UINT_MAX ); break;
case VIPS_FORMAT_INT:
LOOPU( signed int, INT_MAX ); break;
case IM_BANDFMT_FLOAT: LOOP( float ); break;
case IM_BANDFMT_DOUBLE: LOOP( double ); break;
case VIPS_FORMAT_FLOAT:
LOOP( float ); break;
case VIPS_FORMAT_DOUBLE:
LOOP( double ); break;
case IM_BANDFMT_COMPLEX:CLOOP( float ); break;
case IM_BANDFMT_DPCOMPLEX:CLOOP( double ); break;
case VIPS_FORMAT_COMPLEX:
CLOOP( float ); break;
case VIPS_FORMAT_DPCOMPLEX:
CLOOP( double ); break;
default:
g_assert( 0 );

View File

@ -263,18 +263,28 @@ vips_min_scan( VipsStatistic *statistic, void *seq,
int i;
switch( vips_image_get_format( statistic->in ) ) {
case IM_BANDFMT_UCHAR: LOOPL( unsigned char, 0 ); break;
case IM_BANDFMT_CHAR: LOOPL( signed char, SCHAR_MIN ); break;
case IM_BANDFMT_USHORT: LOOPL( unsigned short, 0 ); break;
case IM_BANDFMT_SHORT: LOOPL( signed short, SHRT_MIN ); break;
case IM_BANDFMT_UINT: LOOPL( unsigned int, 0 ); break;
case IM_BANDFMT_INT: LOOPL( signed int, INT_MIN ); break;
case VIPS_FORMAT_UCHAR:
LOOPL( unsigned char, 0 ); break;
case VIPS_FORMAT_CHAR:
LOOPL( signed char, SCHAR_MIN ); break;
case VIPS_FORMAT_USHORT:
LOOPL( unsigned short, 0 ); break;
case VIPS_FORMAT_SHORT:
LOOPL( signed short, SHRT_MIN ); break;
case VIPS_FORMAT_UINT:
LOOPL( unsigned int, 0 ); break;
case VIPS_FORMAT_INT:
LOOPL( signed int, INT_MIN ); break;
case IM_BANDFMT_FLOAT: LOOP( float ); break;
case IM_BANDFMT_DOUBLE: LOOP( double ); break;
case VIPS_FORMAT_FLOAT:
LOOP( float ); break;
case VIPS_FORMAT_DOUBLE:
LOOP( double ); break;
case IM_BANDFMT_COMPLEX: CLOOP( float ); break;
case IM_BANDFMT_DPCOMPLEX: CLOOP( double ); break;
case VIPS_FORMAT_COMPLEX:
CLOOP( float ); break;
case VIPS_FORMAT_DPCOMPLEX:
CLOOP( double ); break;
default:
g_assert( 0 );

View File

@ -248,7 +248,7 @@ vips_join_class_init( VipsJoinClass *class )
gobject_class->get_property = vips_object_get_property;
vobject_class->nickname = "join";
vobject_class->description = _( "join an image" );
vobject_class->description = _( "join a pair of images" );
vobject_class->build = vips_join_build;
VIPS_ARG_IMAGE( class, "in1", -1,