From ab3bc68d40a1728df9ea153e9edb1feabd1be41d Mon Sep 17 00:00:00 2001 From: Pavel Charvat Date: Mon, 2 Oct 2006 15:55:26 +0200 Subject: [PATCH] more MJ's corrections... to be continue --- images/Makefile | 2 +- images/color.c | 6 +++--- images/color.t | 1 - images/context.c | 4 +--- images/image-test.c | 9 +++++++++ images/image-tool.c | 2 +- images/image.c | 4 ++-- images/images.h | 10 +++++----- 8 files changed, 22 insertions(+), 16 deletions(-) diff --git a/images/Makefile b/images/Makefile index a4a2fb26..0b4b27de 100644 --- a/images/Makefile +++ b/images/Makefile @@ -65,7 +65,7 @@ $(o)/images/image-sim-test: LIBS+=$(LIBIMAGES_LIBS) TESTS+=$(o)/images/image-test.test $(o)/images/image-test: $(o)/images/image-test.o $(LIBIMAGES) $(LIBUCW) -$(o)/images/image-test: LIBS+=$(LIBIMAGES_LIBS) -lpthread +$(o)/images/image-test: LIBS+=$(LIBIMAGES_LIBS) $(o)/images/image-test.test: $(o)/images/image-test TESTS+=$(o)/images/hilbert-test.test diff --git a/images/color.c b/images/color.c index ee4e8b8b..8ea60228 100644 --- a/images/color.c +++ b/images/color.c @@ -208,7 +208,7 @@ color_compute_color_space_to_xyz_matrix(double matrix[9], const struct color_spa matrix[8] = a[8] * rc; } -/* computes matrix to join transofmations with different reference whites */ +/* computes matrix to join transformations with different reference whites */ void color_compute_bradford_matrix(double matrix[9], const double source[2], const double dest[2]) { @@ -429,7 +429,7 @@ interpolation_table_init(void) for (p[0] = 0; p[0] < (1 << COLOR_CONV_OFS); p[0]++) { uns index; - static const uns tetrahedrons[5][4] = { + static const uns tetrahedra[5][4] = { {0000, 0001, 0010, 0100}, {0110, 0111, 0100, 0010}, {0101, 0100, 0111, 0001}, @@ -445,7 +445,7 @@ interpolation_table_init(void) index = 3; else index = 4; - interpolate_tetrahedron(n, p, tetrahedrons[index]); + interpolate_tetrahedron(n, p, tetrahedra[index]); n++; } } diff --git a/images/color.t b/images/color.t index 42596089..acae30f4 100644 --- a/images/color.t +++ b/images/color.t @@ -1,4 +1,3 @@ # Tests for color conversion module Run: obj/images/color-t - diff --git a/images/context.c b/images/context.c index bcabc520..6281ba3c 100644 --- a/images/context.c +++ b/images/context.c @@ -46,12 +46,10 @@ image_context_msg_silent(struct image_context *ctx UNUSED) void image_context_msg(struct image_context *ctx, uns code, char *msg, ...) { - ctx->msg_code = code; va_list args; va_start(args, msg); - ctx->msg = bb_vprintf(&ctx->msg_buf, msg, args); + image_context_vmsg(ctx, code, msg, args); va_end(args); - ctx->msg_callback(ctx); } void diff --git a/images/image-test.c b/images/image-test.c index de47695d..b046672f 100644 --- a/images/image-test.c +++ b/images/image-test.c @@ -1,3 +1,12 @@ +/* + * Image Library -- Simple automatic tests + * + * (c) 2006 Pavel Charvat + * + * This software may be freely distributed and used according to the terms + * of the GNU Lesser General Public License. + */ + #undef LOCAL_DEBUG #include "lib/lib.h" diff --git a/images/image-tool.c b/images/image-tool.c index e37f4496..fedd9f1a 100644 --- a/images/image-tool.c +++ b/images/image-tool.c @@ -1,5 +1,5 @@ /* - * Simple image manupulation utility + * Image Library -- Simple image manipulation utility * * (c) 2006 Pavel Charvat * diff --git a/images/image.c b/images/image.c index 2bdcd189..e6111ab8 100644 --- a/images/image.c +++ b/images/image.c @@ -238,8 +238,8 @@ image_name_to_channels_format(byte *name) if (!strcasecmp(name, "rgb")) return COLOR_SPACE_RGB; if (!strcasecmp(name, "rgbalpha")) - return COLOR_SPACE_RGB + IMAGE_ALPHA; + return COLOR_SPACE_RGB | IMAGE_ALPHA; if (!strcasecmp(name, "rgba")) - return COLOR_SPACE_RGB + IMAGE_ALPHA; + return COLOR_SPACE_RGB | IMAGE_ALPHA; return 0; } diff --git a/images/images.h b/images/images.h index 46370f65..616c17b3 100644 --- a/images/images.h +++ b/images/images.h @@ -1,5 +1,5 @@ /* - * Image Library -- Main hearer file + * Image Library -- Main header file * * (c) 2006 Pavel Charvat * @@ -18,7 +18,7 @@ struct fastbuf; /* 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 */ @@ -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 */ -#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 */ @@ -70,10 +70,10 @@ enum image_flag { struct image { byte *pixels; /* aligned top left pixel, there are at least sizeof(uns) - unsed bytes after the buffer (possible optimizations) */ + unused 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 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 */ -- 2.39.2