• R/O
  • SSH

GM: Commit

Main GraphicsMagick source repository


Commit MetaInfo

Révision671a33015c59e060d75e5d1ff5ce4dafa00351b9 (tree)
l'heure2022-08-06 23:24:04
AuteurBob Friesenhahn <bfriesen@Grap...>
CommiterBob Friesenhahn

Message de Log

TGA: Enhance traces. Normalize on 'unsigned int' for more performance.

Change Summary

Modification

diff -r 2504f4ed1a52 -r 671a33015c59 ChangeLog
--- a/ChangeLog Thu Aug 04 14:23:15 2022 -0500
+++ b/ChangeLog Sat Aug 06 09:24:04 2022 -0500
@@ -1,3 +1,9 @@
1+2022-08-06 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
2+
3+ * coders/tga.c: Enhance 'coder' level trace information.
4+ Normalize on 'unsigned int' as much as possible in order to use
5+ natural types and likely help with function inligning.
6+
17 2022-08-04 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
28
39 * coders/tga.c (ReadTGAImage): Remove a defective validation of
diff -r 2504f4ed1a52 -r 671a33015c59 VisualMagick/installer/inc/version.isx
--- a/VisualMagick/installer/inc/version.isx Thu Aug 04 14:23:15 2022 -0500
+++ b/VisualMagick/installer/inc/version.isx Sat Aug 06 09:24:04 2022 -0500
@@ -10,5 +10,5 @@
1010
1111 #define public MagickPackageName "GraphicsMagick"
1212 #define public MagickPackageVersion "1.4"
13-#define public MagickPackageVersionAddendum ".020220804"
14-#define public MagickPackageReleaseDate "snapshot-20220804"
13+#define public MagickPackageVersionAddendum ".020220806"
14+#define public MagickPackageReleaseDate "snapshot-20220806"
diff -r 2504f4ed1a52 -r 671a33015c59 coders/tga.c
--- a/coders/tga.c Thu Aug 04 14:23:15 2022 -0500
+++ b/coders/tga.c Sat Aug 06 09:24:04 2022 -0500
@@ -1,5 +1,5 @@
11 /*
2-% Copyright (C) 2003 - 2020 GraphicsMagick Group
2+% Copyright (C) 2003 - 2022 GraphicsMagick Group
33 % Copyright (C) 2002 ImageMagick Studio
44 % Copyright 1991-1999 E. I. du Pont de Nemours and Company
55 %
@@ -40,6 +40,7 @@
4040 #include "magick/attribute.h"
4141 #include "magick/blob.h"
4242 #include "magick/colormap.h"
43+#include "magick/enum_strings.h"
4344 #include "magick/log.h"
4445 #include "magick/magick.h"
4546 #include "magick/monitor.h"
@@ -53,42 +54,86 @@
5354 WriteTGAImage(const ImageInfo *,Image *);
5455
5556
56-#define TGAColormap 1 /* Colormapped image data */
57-#define TGARGB 2 /* Truecolor image data */
58-#define TGAMonochrome 3 /* Monochrome image data */
59-#define TGARLEColormap 9 /* Colormapped image data (encoded) */
60-#define TGARLERGB 10 /* Truecolor image data (encoded) */
61-#define TGARLEMonochrome 11 /* Monochrome image data (encoded) */
57+#define TGAColormap 1U /* Colormapped image data */
58+#define TGARGB 2U /* Truecolor image data */
59+#define TGAMonochrome 3U /* Monochrome image data */
60+#define TGARLEColormap 9U /* Colormapped image data (encoded) */
61+#define TGARLERGB 10U /* Truecolor image data (encoded) */
62+#define TGARLEMonochrome 11U /* Monochrome image data (encoded) */
6263
6364 typedef struct _TGAInfo
6465 {
65- unsigned char
66- id_length, /* Size of Image ID field (starting after header) */
67- colormap_type, /* Color map type */
68- image_type; /* Image type code */
69-
70- unsigned short
71- colormap_index, /* Color map origin */
72- colormap_length; /* Color map length */
66+ unsigned int
67+ id_length, /* (U8) Size of Image ID field (starting after header) */
68+ colormap_type, /* (U8) Color map type */
69+ image_type; /* (U8) Image type code */
7370
74- unsigned char
75- colormap_size; /* Color map entry depth */
71+ unsigned int
72+ colormap_index, /* (U16) Color map origin */
73+ colormap_length; /* (U16) Color map length */
7674
77- unsigned short
78- x_origin, /* X origin of image */
79- y_origin, /* Y orgin of image */
80- width, /* Width of image */
81- height; /* Height of image */
75+ unsigned int
76+ colormap_size; /* (U8) Color map entry depth */
8277
83- unsigned char
84- bits_per_pixel, /* Image pixel size */
85- attributes; /* Image descriptor byte */
78+ unsigned int
79+ x_origin, /* (U16) X origin of image */
80+ y_origin, /* (U16) Y orgin of image */
81+ width, /* (U16) Width of image */
82+ height; /* (U16) Height of image */
83+
84+ unsigned int
85+ bits_per_pixel, /* (U8) Image pixel size */
86+ attributes; /* (U8) Image descriptor byte (see below) */
8687 } TGAInfo;
8788
89+/*
90+ Image descriptor byte decode:
91+
92+ Bits 0 through 3 specify the number of attribute bits per pixel.
93+
94+ Bits 5 and 4 contain the image origin location. These bits are used
95+ to indicate the order in which pixel data is transferred from the
96+ file to the screen. Bit 4 is for left-to-right ordering, and bit 5
97+ is for top-to-bottom ordering as shown below:
98+
99+ 00 (0) - Bottom Left
100+ 10 (2) - Top Left
101+ 01 (1) - Bottom Right
102+ 11 (3) - Top Right
103+
104+ Screen destination | Image Origin
105+ of first pixel | Bit 5 | Bit 4
106+ --------------------+-------+------
107+ Bottom left | 0 | 0
108+ Bottom right | 0 | 1
109+ Top left | 1 | 0
110+ Top right | 1 | 1
111+*/
112+
88113
89-
90114 static void LogTGAInfo(const TGAInfo *tga_info)
91115 {
116+ OrientationType orientation;
117+ unsigned int attribute_bits;
118+
119+ attribute_bits = tga_info->attributes & 0xf;
120+
121+ switch((tga_info->attributes >> 4) & 3)
122+ {
123+ case 0:
124+ orientation=BottomLeftOrientation;
125+ break;
126+ case 1:
127+ orientation=BottomRightOrientation;
128+ break;
129+ case 2:
130+ orientation=TopLeftOrientation;
131+ break;
132+ case 3:
133+ orientation=TopRightOrientation;
134+ break;
135+ }
136+
92137 (void) LogMagickEvent(CoderEvent,GetMagickModule(),
93138 "Targa Header:\n"
94139 " ImageType : %s\n"
@@ -101,7 +146,7 @@
101146 " Width : %u\n"
102147 " Height : %u\n"
103148 " PixelDepth : %u\n"
104- " Attributes : 0x%.2x",
149+ " Attributes : 0x%.2x (AttributeBits: %u, Orientation: %s)",
105150 ((tga_info->image_type == TGAColormap) ? "Colormapped" :
106151 (tga_info->image_type == TGARGB) ? "TrueColor" :
107152 (tga_info->image_type == TGAMonochrome) ? "Monochrome" :
@@ -116,13 +161,13 @@
116161 tga_info->x_origin, tga_info->y_origin,
117162 tga_info->width, tga_info->height,
118163 (unsigned int) tga_info->bits_per_pixel,
119- tga_info->attributes);
164+ tga_info->attributes,attribute_bits,OrientationTypeToString(orientation));
120165
121166 }
122167
123-static magick_uint16_t ReadBlobLSBShortFromBuffer(unsigned char* buffer, size_t* readerpos)
168+static unsigned int ReadBlobLSBShortFromBuffer(unsigned char* buffer, size_t* readerpos)
124169 {
125- magick_uint16_t
170+ unsigned int
126171 value;
127172
128173 value=buffer[(*readerpos)+1] << 8;
@@ -132,12 +177,12 @@
132177 }
133178
134179
135-static int ReadBlobByteFromBuffer(unsigned char* buffer, size_t* readerpos)
180+static unsigned int ReadBlobByteFromBuffer(unsigned char* buffer, size_t* readerpos)
136181 {
137- int
182+ unsigned int
138183 value;
139184
140- value=(int)(buffer[*readerpos]);
185+ value=(unsigned int)(buffer[*readerpos]);
141186 *readerpos = *readerpos + 1;
142187 return(value);
143188 }
@@ -458,7 +503,7 @@
458503 for (y=0; y < (long) image->rows; y++)
459504 {
460505 real=offset;
461- if (((unsigned char) (tga_info.attributes & 0x20) >> 5) == 0)
506+ if (((tga_info.attributes & 0x20) >> 5) == 0)
462507 real=image->rows-real-1;
463508 q=SetImagePixels(image,0,(long) real,image->columns,1);
464509 if (q == (PixelPacket *) NULL)
diff -r 2504f4ed1a52 -r 671a33015c59 magick/version.h
--- a/magick/version.h Thu Aug 04 14:23:15 2022 -0500
+++ b/magick/version.h Sat Aug 06 09:24:04 2022 -0500
@@ -38,8 +38,8 @@
3838 #define MagickLibVersion 0x272400
3939 #define MagickLibVersionText "1.4"
4040 #define MagickLibVersionNumber 27,24,0
41-#define MagickChangeDate "20220804"
42-#define MagickReleaseDate "snapshot-20220804"
41+#define MagickChangeDate "20220806"
42+#define MagickReleaseDate "snapshot-20220806"
4343
4444 /*
4545 The MagickLibInterfaceNewest and MagickLibInterfaceOldest defines
diff -r 2504f4ed1a52 -r 671a33015c59 www/Changelog.html
--- a/www/Changelog.html Thu Aug 04 14:23:15 2022 -0500
+++ b/www/Changelog.html Sat Aug 06 09:24:04 2022 -0500
@@ -35,6 +35,11 @@
3535 <div class="document">
3636
3737
38+<p>2022-08-06 Bob Friesenhahn &lt;<a class="reference external" href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#64;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
39+<blockquote>
40+* coders/tga.c: Enhance 'coder' level trace information.
41+Normalize on 'unsigned int' as much as possible in order to use
42+natural types and likely help with function inligning.</blockquote>
3843 <p>2022-08-04 Bob Friesenhahn &lt;<a class="reference external" href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#64;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
3944 <blockquote>
4045 * coders/tga.c (ReadTGAImage): Remove a defective validation of
Afficher sur ancien navigateur de dépôt.