]> mj.ucw.cz Git - libucw.git/commitdiff
* removed CONFIG_IMAGES_EXIF switch (always enabled)
authorPavel Charvat <pavel.charvat@netcentrum.cz>
Mon, 2 Oct 2006 14:21:16 +0000 (16:21 +0200)
committerPavel Charvat <pavel.charvat@netcentrum.cz>
Mon, 2 Oct 2006 14:21:16 +0000 (16:21 +0200)
* u32 -> uns  in struct image/image_io

images/image-tool.c
images/images.h
images/io-libjpeg.c
images/scale.c

index fedd9f1a1b0a3412fe8800e57fbdf8ea2e49fbf8..3e40bcb95b5c2464f6fa5ab0f33bab1410148f7d 100644 (file)
@@ -33,10 +33,8 @@ Usage: image-tool [options] infile [outfile]\n\
 -Q --jpeg-quality        JPEG quality (1..100)\n\
 -g --background          background color (hexadecimal RRGGBB)\n\
 -G --default-background  background applied only if the image contains no background info (RRGGBB, default=FFFFFF)\n\
 -Q --jpeg-quality        JPEG quality (1..100)\n\
 -g --background          background color (hexadecimal RRGGBB)\n\
 -G --default-background  background applied only if the image contains no background info (RRGGBB, default=FFFFFF)\n\
--a --remove-alpha        remove alpha channel\n"
-#ifdef CONFIG_IMAGES_EXIF
-"-e --exif                reads Exif data\n"
-#endif
+-a --remove-alpha        remove alpha channel\n\
+-e --exif                reads Exif data\n"
 , stderr);
   exit(1);
 }
 , stderr);
   exit(1);
 }
@@ -54,9 +52,7 @@ static struct option longopts[] =
   { "background",              0, 0, 'g' },
   { "default-background",      0, 0, 'G' },
   { "remove-alpha",            0, 0, 'a' },
   { "background",              0, 0, 'g' },
   { "default-background",      0, 0, 'G' },
   { "remove-alpha",            0, 0, 'a' },
-#ifdef CONFIG_IMAGES_EXIF
   { "exif",                    0, 0, 'e' },
   { "exif",                    0, 0, 'e' },
-#endif
   { NULL,                      0, 0, 0 }
 };
 
   { NULL,                      0, 0, 0 }
 };
 
@@ -73,9 +69,7 @@ static uns jpeg_quality;
 static struct color background_color;
 static struct color default_background_color;
 static uns remove_alpha;
 static struct color background_color;
 static struct color default_background_color;
 static uns remove_alpha;
-#ifdef CONFIG_IMAGES_EXIF
 static uns exif;
 static uns exif;
-#endif
 
 static void
 parse_color(struct color *color, byte *s)
 
 static void
 parse_color(struct color *color, byte *s)
@@ -151,11 +145,9 @@ main(int argc, char **argv)
        case 'a':
          remove_alpha++;
          break;
        case 'a':
          remove_alpha++;
          break;
-#ifdef CONFIG_IMAGES_EXIF
        case 'e':
          exif++;
          break;
        case 'e':
          exif++;
          break;
-#endif
        default:
          usage();
       }
        default:
          usage();
       }
@@ -178,10 +170,8 @@ main(int argc, char **argv)
   MSG("Reading %s", input_file_name);
   io.fastbuf = bopen(input_file_name, O_RDONLY, 1 << 18);
   io.format = input_format ? : image_file_name_to_format(input_file_name);
   MSG("Reading %s", input_file_name);
   io.fastbuf = bopen(input_file_name, O_RDONLY, 1 << 18);
   io.format = input_format ? : image_file_name_to_format(input_file_name);
-#ifdef CONFIG_IMAGES_EXIF
   if (exif)
     io.flags |= IMAGE_IO_WANT_EXIF;
   if (exif)
     io.flags |= IMAGE_IO_WANT_EXIF;
-#endif
   TRY(image_io_read_header(&io));
   if (!output_file_name)
     {
   TRY(image_io_read_header(&io));
   if (!output_file_name)
     {
@@ -196,10 +186,8 @@ main(int argc, char **argv)
          color_put_rgb(rgb, &io.background_color);
           printf("Background:  %02x%02x%02x\n", rgb[0], rgb[1], rgb[2]);
        }
          color_put_rgb(rgb, &io.background_color);
           printf("Background:  %02x%02x%02x\n", rgb[0], rgb[1], rgb[2]);
        }
-#ifdef CONFIG_IMAGES_EXIF
       if (io.exif_size)
        printf("ExifSize:    %u\n", io.exif_size);
       if (io.exif_size)
        printf("ExifSize:    %u\n", io.exif_size);
-#endif
     }
   else
     {
     }
   else
     {
index 616c17b3cd8c6e1430ab76ba8bd02d18d498a41a..dbaa055c5af5e6cdbfd02d7f897e75c34001ee10 100644 (file)
@@ -71,13 +71,13 @@ enum image_flag {
 struct image {
   byte *pixels;                        /* aligned top left pixel, there are at least sizeof(uns)
                                   unused bytes after the buffer (possible optimizations) */
 struct image {
   byte *pixels;                        /* aligned top left pixel, there are at least sizeof(uns)
                                   unused bytes after the buffer (possible optimizations) */
-  u32 cols;                    /* number of columns */
-  u32 rows;                    /* number of rows */
-  u32 pixel_size;              /* size of pixel in bytes (1, 2, 3 or 4) */
-  u32 row_size;                        /* scanline size in bytes */
-  u32 row_pixels_size;         /* scanline size in bytes excluding rows gaps */
-  u32 image_size;              /* rows * row_size */
-  u32 flags;                   /* enum image_flag */
+  uns cols;                    /* number of columns */
+  uns rows;                    /* number of rows */
+  uns pixel_size;              /* size of pixel in bytes (1, 2, 3 or 4) */
+  uns row_size;                        /* scanline size in bytes */
+  uns row_pixels_size;         /* scanline size in bytes excluding rows gaps */
+  uns image_size;              /* rows * row_size */
+  uns flags;                   /* enum image_flag */
 };
 
 struct image *image_new(struct image_context *ctx, uns cols, uns rows, uns flags, struct mempool *pool);
 };
 
 struct image *image_new(struct image_context *ctx, uns cols, uns rows, uns flags, struct mempool *pool);
@@ -105,7 +105,7 @@ struct color {
 /* scale.c */
 
 int image_scale(struct image_context *ctx, struct image *dest, struct image *src);
 /* scale.c */
 
 int image_scale(struct image_context *ctx, struct image *dest, struct image *src);
-void image_dimensions_fit_to_box(u32 *cols, u32 *rows, u32 max_cols, u32 max_rows, uns upsample);
+void image_dimensions_fit_to_box(uns *cols, uns *rows, uns max_cols, uns max_rows, uns upsample);
 
 /* alpha.c */
 
 
 /* alpha.c */
 
@@ -132,16 +132,14 @@ struct image_io {
   enum image_format format;            /* [R   W] - file format (IMAGE_FORMAT_x) */
   struct fastbuf *fastbuf;             /* [R   W] - source/destination stream */
   struct mempool *pool;                        /* [  I  ] - parameter to image_new */
   enum image_format format;            /* [R   W] - file format (IMAGE_FORMAT_x) */
   struct fastbuf *fastbuf;             /* [R   W] - source/destination stream */
   struct mempool *pool;                        /* [  I  ] - parameter to image_new */
-  u32 cols;                            /* [ HI  ] - number of columns, parameter to image_new */
-  u32 rows;                            /* [ HI  ] - number of rows, parameter to image_new */
-  u32 flags;                           /* [ HI  ] - see enum image_io_flags */
-  u32 jpeg_quality;                    /* [    W] - JPEG compression quality (1..100) */
-  u32 number_of_colors;                        /* [ H   ] - number of image colors */
+  uns cols;                            /* [ HI  ] - number of columns, parameter to image_new */
+  uns rows;                            /* [ HI  ] - number of rows, parameter to image_new */
+  uns flags;                           /* [ HI  ] - see enum image_io_flags */
+  uns jpeg_quality;                    /* [    W] - JPEG compression quality (1..100) */
+  uns number_of_colors;                        /* [ H   ] - number of image colors */
   struct color background_color;       /* [ HI  ] - background color, zero if undefined */
   struct color background_color;       /* [ HI  ] - background color, zero if undefined */
-#ifdef CONFIG_IMAGES_EXIF
-  u32 exif_size;                       /* [ H  W] - EXIF size in bytes (zero if not present) */
+  uns exif_size;                       /* [ H  W] - EXIF size in bytes (zero if not present) */
   byte *exif_data;                     /* [ H  W] - EXIF data */
   byte *exif_data;                     /* [ H  W] - EXIF data */
-#endif
 
   /* internals */
   struct image_context *context;
 
   /* internals */
   struct image_context *context;
@@ -155,9 +153,7 @@ enum image_io_flags {
   IMAGE_IO_NEED_DESTROY = 0x10000,     /* [   O ] - enables automatic call of image_destroy */
   IMAGE_IO_HAS_PALETTE = 0x20000,      /* [ H   ] - true for image with indexed colors */
   IMAGE_IO_USE_BACKGROUND = 0x40000,   /* [  I  ] - merge transparent pixels with background_color */
   IMAGE_IO_NEED_DESTROY = 0x10000,     /* [   O ] - enables automatic call of image_destroy */
   IMAGE_IO_HAS_PALETTE = 0x20000,      /* [ H   ] - true for image with indexed colors */
   IMAGE_IO_USE_BACKGROUND = 0x40000,   /* [  I  ] - merge transparent pixels with background_color */
-#ifdef CONFIG_IMAGES_EXIF
   IMAGE_IO_WANT_EXIF = 0x80000,                /* [R    ] - read EXIF data if present */
   IMAGE_IO_WANT_EXIF = 0x80000,                /* [R    ] - read EXIF data if present */
-#endif
 };
 
 int image_io_init(struct image_context *ctx, struct image_io *io);
 };
 
 int image_io_init(struct image_context *ctx, struct image_io *io);
index e8714458f26b659ffd341e3477d8b129de5961d8..52edd03bf79603155fbd824a8d4d85e8bed6b8c4 100644 (file)
@@ -185,8 +185,6 @@ libjpeg_empty_output_buffer(j_compress_ptr cinfo)
   return TRUE;
 }
 
   return TRUE;
 }
 
-#ifdef CONFIG_IMAGES_EXIF
-
 static inline uns
 libjpeg_read_byte(struct libjpeg_read_internals *i)
 {
 static inline uns
 libjpeg_read_byte(struct libjpeg_read_internals *i)
 {
@@ -248,8 +246,6 @@ libjpeg_app1_preprocessor(j_decompress_ptr cinfo)
   return TRUE;
 }
 
   return TRUE;
 }
 
-#endif
-
 static void
 libjpeg_read_cancel(struct image_io *io)
 {
 static void
 libjpeg_read_cancel(struct image_io *io)
 {
@@ -287,10 +283,8 @@ libjpeg_read_header(struct image_io *io)
   i->src.resync_to_restart = jpeg_resync_to_restart;
   i->src.term_source = libjpeg_term_source;
 
   i->src.resync_to_restart = jpeg_resync_to_restart;
   i->src.term_source = libjpeg_term_source;
 
-#ifdef CONFIG_IMAGES_EXIF
   if (io->flags & IMAGE_IO_WANT_EXIF)
     jpeg_set_marker_processor(&i->cinfo, JPEG_APP0 + 1, libjpeg_app1_preprocessor);
   if (io->flags & IMAGE_IO_WANT_EXIF)
     jpeg_set_marker_processor(&i->cinfo, JPEG_APP0 + 1, libjpeg_app1_preprocessor);
-#endif
 
   /* Read JPEG header and setup decompression options */
   DBG("Reading image header");
 
   /* Read JPEG header and setup decompression options */
   DBG("Reading image header");
@@ -479,7 +473,6 @@ libjpeg_write(struct image_io *io)
   jpeg_set_defaults(&i.cinfo);
   if (io->jpeg_quality)
     jpeg_set_quality(&i.cinfo, MIN(io->jpeg_quality, 100), 1);
   jpeg_set_defaults(&i.cinfo);
   if (io->jpeg_quality)
     jpeg_set_quality(&i.cinfo, MIN(io->jpeg_quality, 100), 1);
-#ifdef CONFIG_IMAGES_EXIF
   if (io->exif_size)
     {
       /* According to the Exif specification, the Exif APP1 marker has to follow immediately after the SOI,
   if (io->exif_size)
     {
       /* According to the Exif specification, the Exif APP1 marker has to follow immediately after the SOI,
@@ -488,17 +481,14 @@ libjpeg_write(struct image_io *io)
       i.cinfo.write_JFIF_header = FALSE;
       i.cinfo.write_Adobe_marker = FALSE;
     }
       i.cinfo.write_JFIF_header = FALSE;
       i.cinfo.write_Adobe_marker = FALSE;
     }
-#endif
 
   /* Compress the image */
   jpeg_start_compress(&i.cinfo, TRUE);
 
   /* Compress the image */
   jpeg_start_compress(&i.cinfo, TRUE);
-#ifdef CONFIG_IMAGES_EXIF
   if (io->exif_size)
     {
       DBG("Writing EXIF");
       jpeg_write_marker(&i.cinfo, JPEG_APP0 + 1, io->exif_data, io->exif_size);
     }
   if (io->exif_size)
     {
       DBG("Writing EXIF");
       jpeg_write_marker(&i.cinfo, JPEG_APP0 + 1, io->exif_data, io->exif_size);
     }
-#endif
   switch (img->pixel_size)
     {
       /* grayscale or RGB */
   switch (img->pixel_size)
     {
       /* grayscale or RGB */
index 925733a192e78f99e87a46e04dd27b0c83e71f9f..ca80616f95802d949dcf59f3977fffab79fe9690 100644 (file)
@@ -241,7 +241,7 @@ image_scale(struct image_context *ctx, struct image *dest, struct image *src)
 }
 
 void
 }
 
 void
-image_dimensions_fit_to_box(u32 *cols, u32 *rows, u32 max_cols, u32 max_rows, uns upsample)
+image_dimensions_fit_to_box(uns *cols, uns *rows, uns max_cols, uns max_rows, uns upsample)
 {
   ASSERT(image_dimensions_valid(*cols, *rows));
   ASSERT(image_dimensions_valid(max_cols, max_rows));
 {
   ASSERT(image_dimensions_valid(*cols, *rows));
   ASSERT(image_dimensions_valid(max_cols, max_rows));