From 50a75cc5458ba553f5cdcede6c9699f7a0347377 Mon Sep 17 00:00:00 2001 From: taw27 Date: Tue, 28 Aug 2007 21:39:35 +0000 Subject: Use unsigned types for image storage git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@82 bf6ca9ba-c028-0410-8290-897cf20841d1 --- src/readpng.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/readpng.c') diff --git a/src/readpng.c b/src/readpng.c index dc72e6e..0ea87fe 100644 --- a/src/readpng.c +++ b/src/readpng.c @@ -37,7 +37,7 @@ int readpng_read(const char *filename, double tilt, ControlContext *ctx) { png_bytep *row_pointers; unsigned int x; unsigned int y; - int16_t *image; + uint16_t *image; /* Open file */ fh = fopen(filename, "rb"); @@ -97,7 +97,7 @@ int readpng_read(const char *filename, double tilt, ControlContext *ctx) { height = png_get_image_height(png_ptr, info_ptr); bit_depth = png_get_bit_depth(png_ptr, info_ptr); channels = png_get_channels(png_ptr, info_ptr); - printf("RI: width=%i, height=%i, depth=%i, channels=%i\n", width, height, bit_depth, channels); + //printf("RI: width=%i, height=%i, depth=%i, channels=%i\n", width, height, bit_depth, channels); if ( (bit_depth != 16) && (bit_depth != 8) ) { printf("RI: Whoops! Can't handle images with other than 8 or 16 bpp yet...\n"); png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); @@ -108,7 +108,7 @@ int readpng_read(const char *filename, double tilt, ControlContext *ctx) { /* Get image data */ row_pointers = png_get_rows(png_ptr, info_ptr); - image = malloc(height * width * sizeof(int16_t)); + image = malloc(height * width * sizeof(uint16_t)); ctx->fmode = FORMULATION_CLEN; for ( y=0; y 65535 ) printf("%i\n", val); } if ( bit_depth == 8 ) { int i; @@ -131,6 +133,7 @@ int readpng_read(const char *filename, double tilt, ControlContext *ctx) { for ( i=0; i