1IM_IOCHECK(3)              Library Functions Manual              IM_IOCHECK(3)
2
3
4

NAME

6       im_demand_hint - hint on demand style for im_generate(3)
7

SYNOPSIS

9       #include <vips/vips.h>
10       #include <vips/region.h>
11
12       int im_demand_hint( im, hint, in1, in2, ..., NULL )
13       IMAGE *im, *in1, *in2, ...;
14       im_demand_type hint;
15
16       int im_demand_hint_array( im, hint, in )
17       IMAGE *im, **in;
18       im_demand_type hint;
19

DESCRIPTION

21       im_demand_hint(3)  suggests  to im_generate(3) the sorts of demand with
22       which this image processing operation would be happiest.
23
24       im is the image this operation is generating.  hint is the demand style
25       this  operation  would  like (see below), and in1 ...  is a NULL-termi‐
26       nated list of the image upon which this output image directly  depends,
27       that is, the images which this operation will call im_prepare(3) for.
28
29       This  list of parent images is necessary, as im_demand_hint(3) needs to
30       know what demand style this operation's ancestors have requested. If an
31       ancestor  of  this  operation  has  specified a very restrictive demand
32       style, then this operation must fall back to that restrictive style and
33       ignore the hint given in this call to im_demand_hint(3).
34
35       VIPS  currently  supports three demand styles. More may be added in the
36       future.  These demand styles are given below  in  order  of  increasing
37       restrictiveness.  When demanding output from a pipeline, im_generate(3)
38       will use the most restrictive of the styles requested by the operations
39       in the pipeline.
40
41       IM_THINSTRIP
42       This operation would like to output strips the width of the image and a
43       few pels high. This is option suitable for  point-to-point  operations,
44       such as those in the arithmetic package.
45
46       This  option  is only efficient for cases where each output pel depends
47       upon the pel in the corresponding position in the input image.
48
49       IM_FATSTRIP
50       This operation would like to output strips the width of the  image  and
51       as  high as possible. This option is suitable for area operations which
52       do not violently transform coordinates, such as im_conv(3).
53
54       IM_SMALLTILE
55       This is the most general demand format, and is the default.  Output  is
56       demanded  in small (around 100x100 pel) sections. This style works rea‐
57       sonably efficiently, even for bizzare operations like 45 degree rotate.
58
59       im_demand_hint_array(3) works exactly as im_demand_hint(3), but expects
60       a  pointer  to  a  NULL-terminated  array of parent images as its third
61       argument. You may use im_allocate_input_array(3), if you wish, to build
62       this structure.
63
64       As an example, here is part of the code for im_invert(3). In this oper‐
65       ation, each output pel depends upon the  corresponding  input  pel.  In
66       other  words,  there  is no coordinate transformation in im_prepare(3).
67       This style of operation is most efficient with IM_THINSTRIP IO.
68
69       int im_invert( IMAGE *in, IMAGE *out )
70       {
71            if( in->Coding != NOCODING ) {
72                 im_errormsg( "im_invert: input coded" );
73                 return( -1 );
74            }
75            if( in->BandFmt != FMTUCHAR ) {
76                 im_errormsg( "im_invert: input not UCHAR" );
77                 return( -1 );
78            }
79               if( im_piocheck( in, out ) )
80                 return( -1 );
81               if( im_cp_desc( out, in ) )
82                 return( -1 );
83            if( im_demand_hint( out, IM_THINSTRIP, in, NULL ) )
84                  return( -1 );
85            if( im_generate( out,
86                 im_start_one, inv_gen, im_stop_one, in, NULL ) )
87                 return( -1 );
88            return( 0 );
89       }
90
91

RETURN VALUE

93       All functions returns 0 on success and non-zero on error.
94

SEE ALSO

96       im_generate(3), im_prepare(3). `VIPS Library  Programmers'  Guide,'  in
97       accompanying documentation.
98
100       National Gallery
101

AUTHOR

103       J. Cupitt - 3/9/93
104
105
106
107                                 11 April 1990                   IM_IOCHECK(3)
Impressum