This commit is contained in:
John Cupitt 2009-11-06 14:35:43 +00:00
parent 7bae8738e0
commit 174fdd782a
4 changed files with 29 additions and 25 deletions

7
TODO
View File

@ -1,11 +1,10 @@
- import ~/summer-demo/summer.tif fails with "unable to read embedded
profile", is this a bug? better err msg would be good
trying to catch errors now, but is it working? not sure
WONTFIX for 7.20
================
- some of deprecated.h repeats stuff we do better in image.h, eg. addr()
should just call IM_REGION_ADDR()
- load 500 jpegs, group, shrink, save
VM use is huge, ouch, could we use a bit less?

View File

@ -121,10 +121,10 @@ extern "C" {
* lsize() sizeof scan line
* niele() number of elements in scan line
*/
#define esize(I) ((I)->Bbits >> 3)
#define psize(I) (esize(I)*(I)->Bands)
#define lsize(I) (psize(I)*(I)->Xsize)
#define niele(I) ((I)->Bands*(I)->Xsize)
#define esize(I) IM_IMAGE_SIZEOF_ELEMENT(I)
#define psize(I) IM_IMAGE_SIZEOF_PEL(I)
#define lsize(I) IM_IMAGE_SIZEOF_LINE(I)
#define niele(I) IM_IMAGE_N_ELEMENTS(I)
/* Macros on REGIONs.
* lskip() add to move down line

View File

@ -239,17 +239,18 @@ typedef struct _VipsImage {
gboolean hint_set;
} VipsImage;
extern const size_t im__sizeof_bandfmt[];
/* Pixel address calculation macros.
*/
#define IM_IMAGE_SIZEOF_ELEMENT(I) \
((size_t)((I)->Bbits >> 3))
(im__sizeof_bandfmt[(I)->BandFmt])
#define IM_IMAGE_SIZEOF_PEL(I) \
((size_t)(IM_IMAGE_SIZEOF_ELEMENT(I) * (I)->Bands))
(IM_IMAGE_SIZEOF_ELEMENT(I) * (I)->Bands)
#define IM_IMAGE_SIZEOF_LINE(I) \
((size_t)(IM_IMAGE_SIZEOF_PEL(I) * (I)->Xsize))
(IM_IMAGE_SIZEOF_PEL(I) * (I)->Xsize)
#define IM_IMAGE_N_ELEMENTS(I) \
((size_t)((I)->Bands * (I)->Xsize))
((I)->Bands * (I)->Xsize)
/* If DEBUG is defined, add bounds checking.
*/

View File

@ -56,6 +56,7 @@
#include <assert.h>
#include <vips/vips.h>
#include <vips/internal.h>
#ifdef WITH_DMALLOC
#include <dmalloc.h>
@ -1515,17 +1516,20 @@ im__open_temp( void )
return( disc );
}
static const int bits[] = {
IM_BBITS_BYTE,
IM_BBITS_BYTE,
IM_BBITS_SHORT,
IM_BBITS_SHORT,
IM_BBITS_INT,
IM_BBITS_INT,
IM_BBITS_FLOAT,
IM_BBITS_COMPLEX,
IM_BBITS_DOUBLE,
IM_BBITS_DPCOMPLEX
/* This gets indexed by (eg.) IM_IMAGE_SIZEOF_ELEMENT() to calculate object
* size.
*/
const size_t im__sizeof_bandfmt[] = {
IM_BBITS_BYTE >> 3,
IM_BBITS_BYTE >> 3,
IM_BBITS_SHORT >> 3,
IM_BBITS_SHORT >> 3,
IM_BBITS_INT >> 3,
IM_BBITS_INT >> 3,
IM_BBITS_FLOAT >> 3,
IM_BBITS_COMPLEX >> 3,
IM_BBITS_DOUBLE >> 3,
IM_BBITS_DPCOMPLEX >> 3
};
/* Return number of pel bits for band format, or -1 on error.
@ -1537,6 +1541,6 @@ im_bits_of_fmt( VipsBandFmt fmt )
im_error( "im_bits_of_fmt",
_( "unsupported band format: %d" ), fmt ),
-1 :
bits[fmt] );
im__sizeof_bandfmt[fmt] << 3 );
}