]> mj.ucw.cz Git - libucw.git/blobdiff - images/images.h
Merge with git+ssh://git.ucw.cz/projects/sherlock/GIT/sherlock.git
[libucw.git] / images / images.h
index 46370f65cd15f2f7fec7abd0f3e272cf8b321518..dbaa055c5af5e6cdbfd02d7f897e75c34001ee10 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- *     Image Library -- Main hearer file
+ *     Image Library -- Main header file
  *
  *     (c) 2006 Pavel Charvat <pchar@ucw.cz>
  *
  *
  *     (c) 2006 Pavel Charvat <pchar@ucw.cz>
  *
@@ -18,7 +18,7 @@ struct fastbuf;
 
 /* context.c
  * - contexts with error/message handling
 
 /* context.c
  * - contexts with error/message handling
- * - imagelib is thread-safe until each context is bounded to a single thread */
+ * - imagelib is thread-safe as long as threads work in different contexts */
 
 struct image_context {
   byte *msg;                           /* last message */
 
 struct image_context {
   byte *msg;                           /* last message */
@@ -52,7 +52,7 @@ extern uns image_max_dim;             /* ImageLib.ImageMaxDim */
 extern uns image_max_bytes;            /* ImageLib.ImageMaxBytes */
 
 /* SSE aligning size, see IMAGE_SSE_ALIGNED */
 extern uns image_max_bytes;            /* ImageLib.ImageMaxBytes */
 
 /* SSE aligning size, see IMAGE_SSE_ALIGNED */
-#define IMAGE_SSE_ALIGN_SIZE (MAX(16, sizeof(uns)))
+#define IMAGE_SSE_ALIGN_SIZE 16
 
 enum image_flag {
   IMAGE_COLOR_SPACE = 0x7,             /* mask for enum color_space */
 
 enum image_flag {
   IMAGE_COLOR_SPACE = 0x7,             /* mask for enum color_space */
@@ -70,14 +70,14 @@ enum image_flag {
 
 struct image {
   byte *pixels;                        /* aligned top left pixel, there are at least sizeof(uns)
 
 struct image {
   byte *pixels;                        /* aligned top left pixel, there are at least sizeof(uns)
-                                  unsed bytes after the buffer (possible optimizations) */
-  u32 cols;                    /* number of columns */
-  u32 rows;                    /* number of rows */
-  u32 pixel_size;              /* size of pixel (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 */
+                                  unused bytes after the buffer (possible optimizations) */
+  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);