comparison mupdf-source/thirdparty/libjpeg/install.txt @ 2:b50eed0cc0ef upstream

ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4. The directory name has changed: no version number in the expanded directory now.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:43:07 +0200
parents
children
comparison
equal deleted inserted replaced
1:1d09e1dec1d9 2:b50eed0cc0ef
1 INSTALLATION INSTRUCTIONS for the Independent JPEG Group's JPEG software
2
3 Copyright (C) 1991-2023, Thomas G. Lane, Guido Vollbeding.
4 This file is part of the Independent JPEG Group's software.
5 For conditions of distribution and use, see the accompanying README file.
6
7
8 This file explains how to configure and install the IJG software. We have
9 tried to make this software extremely portable and flexible, so that it can be
10 adapted to almost any environment. The downside of this decision is that the
11 installation process is complicated. We have provided shortcuts to simplify
12 the task on common systems. But in any case, you will need at least a little
13 familiarity with C programming and program build procedures for your system.
14
15 If you are only using this software as part of a larger program, the larger
16 program's installation procedure may take care of configuring the IJG code.
17 For example, Ghostscript's installation script will configure the IJG code.
18 You don't need to read this file if you just want to compile Ghostscript.
19
20 If you are on a Unix machine, you may not need to read this file at all.
21 Try doing
22 ./configure
23 make
24 make test
25 If that doesn't complain, do
26 make install
27 (better do "make -n install" first to see if the makefile will put the files
28 where you want them). Read further if you run into snags or want to customize
29 the code for your system.
30
31
32 TABLE OF CONTENTS
33 -----------------
34
35 Before you start
36 Configuring the software:
37 using the automatic "configure" script
38 using one of the supplied jconfig and makefile files
39 by hand
40 Building the software
41 Testing the software
42 Installing the software
43 Optional stuff
44 Optimization
45 Hints for specific systems
46
47
48 BEFORE YOU START
49 ================
50
51 Before installing the software you must unpack the distributed source code.
52 Since you are reading this file, you have probably already succeeded in this
53 task. However, there is a potential for error if you needed to convert the
54 files to the local standard text file format (for example, if you are on
55 MS-DOS you may have converted LF end-of-line to CR/LF). You must apply
56 such conversion to all the files EXCEPT those whose names begin with "test".
57 The test files contain binary data; if you change them in any way then the
58 self-test will give bad results.
59
60 Please check the last section of this file to see if there are hints for the
61 specific machine or compiler you are using.
62
63
64 CONFIGURING THE SOFTWARE
65 ========================
66
67 To configure the IJG code for your system, you need to create two files:
68 * jconfig.h: contains values for system-dependent #define symbols.
69 * Makefile: controls the compilation process.
70 (On a non-Unix machine, you may create "project files" or some other
71 substitute for a Makefile. jconfig.h is needed in any environment.)
72
73 We provide three different ways to generate these files:
74 * On a Unix system, you can just run the "configure" script.
75 * We provide sample jconfig files and makefiles for popular machines;
76 if your machine matches one of the samples, just copy the right sample
77 files to jconfig.h and Makefile.
78 * If all else fails, read the instructions below and make your own files.
79
80
81 Configuring the software using the automatic "configure" script
82 ---------------------------------------------------------------
83
84 If you are on a Unix machine, you can just type
85 ./configure
86 and let the configure script construct appropriate configuration files.
87 If you're using "csh" on an old version of System V, you might need to type
88 sh configure
89 instead to prevent csh from trying to execute configure itself.
90 Expect configure to run for a few minutes, particularly on slower machines;
91 it works by compiling a series of test programs.
92
93 Configure was created with GNU Autoconf and it follows the usual conventions
94 for GNU configure scripts. It makes a few assumptions that you may want to
95 override. You can do this by providing optional switches to configure:
96
97 * Configure will build both static and shared libraries, if possible.
98 If you want to build libjpeg only as a static library, say
99 ./configure --disable-shared
100 If you want to build libjpeg only as a shared library, say
101 ./configure --disable-static
102 Configure uses GNU libtool to take care of system-dependent shared library
103 building methods.
104
105 * Configure will use gcc (GNU C compiler) if it's available, otherwise cc.
106 To force a particular compiler to be selected, use the CC option, for example
107 ./configure CC='cc'
108 The same method can be used to include any unusual compiler switches.
109 For example, on HP-UX you probably want to say
110 ./configure CC='cc -Aa'
111 to get HP's compiler to run in ANSI mode.
112
113 * The default CFLAGS setting is "-g" for non-gcc compilers, "-g -O2" for gcc.
114 You can override this by saying, for example,
115 ./configure CFLAGS='-O2'
116 if you want to compile without debugging support.
117
118 * Configure will set up the makefile so that "make install" will install files
119 into /usr/local/bin, /usr/local/man, etc. You can specify an installation
120 prefix other than "/usr/local" by giving configure the option "--prefix=PATH".
121
122 * If you don't have a lot of swap space, you may need to enable the IJG
123 software's internal virtual memory mechanism. To do this, give the option
124 "--enable-maxmem=N" where N is the default maxmemory limit in megabytes.
125 This is discussed in more detail under "Selecting a memory manager", below.
126 You probably don't need to worry about this on reasonably-sized Unix machines,
127 unless you plan to process very large images.
128
129 Configure has some other features that are useful if you are cross-compiling
130 or working in a network of multiple machine types; but if you need those
131 features, you probably already know how to use them.
132
133
134 Configuring the software using one of the supplied jconfig and makefile files
135 -----------------------------------------------------------------------------
136
137 If you have one of these systems, you can just use the provided configuration
138 files:
139
140 Makefile jconfig file System and/or compiler
141
142 makefile.manx jconfig.manx Amiga, Manx Aztec C
143 makefile.sas jconfig.sas Amiga, SAS C
144 makeproj.mac jconfig.mac Apple Macintosh, Metrowerks CodeWarrior
145 makefile.xc jconfig.xc Apple Mac, Xcode 15
146 mak*jpeg.st jconfig.st Atari ST/Mega/STE/TT/Falcon, Pure C or Turbo C
147 makefile.bcc jconfig.bcc MS-DOS or OS/2, Borland C
148 makefile.dj jconfig.dj MS-DOS, DJGPP (Delorie's port of GNU C)
149 makefile.mc6 jconfig.mc6 MS-DOS, Microsoft C (16-bit only)
150 makefile.wat jconfig.wat MS-DOS, OS/2, or Windows NT, Watcom C
151 makefile.vc jconfig.vc Windows, MS Visual C++
152 makefile.vs jconfig.vc Windows, MS Visual C++ 6 Developer Studio
153 make*.vc6
154 makefile.vs jconfig.vc Windows, Visual Studio 2019-2022 version 16-17
155 make*.v16
156 makefile.b32 jconfig.vc Windows, C++Builder/RAD Studio 10.4-11
157 mak*jpeg.bcb
158 makefile.b32 jconfig.vc Windows, Embarcadero C++ for Win32 (bcc32)
159 makefile.c32 jconfig.vc Windows, Embarcadero C++ for Win32 (bcc32c)
160 makefile.d32
161 makefile.x32 jconfig.vc Windows, Embarcadero C++ for Win32 (bcc32x)
162 makefile.b64 jconfig.vc Windows, Embarcadero C++ for Win64 (bcc64)
163 makefile.mms jconfig.vms Digital VMS, with MMS software
164 makefile.vms jconfig.vms Digital VMS, without MMS software
165
166 Copy the proper jconfig file to jconfig.h and the makefile to Makefile (or
167 whatever your system uses as the standard makefile name). For more info see
168 the appropriate system-specific hints section near the end of this file.
169
170
171 Configuring the software by hand
172 --------------------------------
173
174 First, generate a jconfig.h file. If you are moderately familiar with C,
175 the comments in jconfig.txt should be enough information to do this; just
176 copy jconfig.txt to jconfig.h and edit it appropriately. Otherwise, you may
177 prefer to use the ckconfig.c program. You will need to compile and execute
178 ckconfig.c by hand --- we hope you know at least enough to do that.
179 ckconfig.c may not compile the first try (in fact, the whole idea is for it
180 to fail if anything is going to). If you get compile errors, fix them by
181 editing ckconfig.c according to the directions given in ckconfig.c. Once
182 you get it to run, it will write a suitable jconfig.h file, and will also
183 print out some advice about which makefile to use.
184
185 You may also want to look at the canned jconfig files, if there is one for a
186 system similar to yours.
187
188 Second, select a makefile and copy it to Makefile (or whatever your system
189 uses as the standard makefile name). The most generic makefiles we provide
190 are
191 makefile.ansi: if your C compiler supports function prototypes
192 makefile.unix: if not.
193 (You have function prototypes if ckconfig.c put "#define HAVE_PROTOTYPES"
194 in jconfig.h.) You may want to start from one of the other makefiles if
195 there is one for a system similar to yours.
196
197 Look over the selected Makefile and adjust options as needed. In particular
198 you may want to change the CC and CFLAGS definitions. For instance, if you
199 are using GCC, set CC=gcc. If you had to use any compiler switches to get
200 ckconfig.c to work, make sure the same switches are in CFLAGS.
201
202 If you are on a system that doesn't use makefiles, you'll need to set up
203 project files (or whatever you do use) to compile all the source files and
204 link them into executable files cjpeg, djpeg, jpegtran, rdjpgcom, and wrjpgcom.
205 See the file lists in any of the makefiles to find out which files go into
206 each program. Note that the provided makefiles all make a "library" file
207 libjpeg first, but you don't have to do that if you don't want to; the file
208 lists identify which source files are actually needed for compression,
209 decompression, or both. As a last resort, you can make a batch script that
210 just compiles everything and links it all together; makefile.vms is an example
211 of this (it's for VMS systems that have no make-like utility).
212
213 Here are comments about some specific configuration decisions you'll
214 need to make:
215
216 Command line style
217 ------------------
218
219 These programs can use a Unix-like command line style which supports
220 redirection and piping, like this:
221 cjpeg inputfile >outputfile
222 cjpeg <inputfile >outputfile
223 source program | cjpeg >outputfile
224 The simpler "two file" command line style is just
225 cjpeg inputfile outputfile
226 You may prefer the two-file style, particularly if you don't have pipes.
227
228 You MUST use two-file style on any system that doesn't cope well with binary
229 data fed through stdin/stdout; this is true for some MS-DOS compilers, for
230 example. If you're not on a Unix system, it's safest to assume you need
231 two-file style. (But if your compiler provides either the Posix-standard
232 fdopen() library routine or a Microsoft-compatible setmode() routine, you
233 can safely use the Unix command line style, by defining USE_FDOPEN or
234 USE_SETMODE respectively.)
235
236 To use the two-file style, make jconfig.h say "#define TWO_FILE_COMMANDLINE".
237
238 Selecting a memory manager
239 --------------------------
240
241 The IJG code is capable of working on images that are too big to fit in main
242 memory; data is swapped out to temporary files as necessary. However, the
243 code to do this is rather system-dependent. We provide five different
244 memory managers:
245
246 * jmemansi.c This version uses the ANSI-standard library routine tmpfile(),
247 which not all non-ANSI systems have. On some systems
248 tmpfile() may put the temporary file in a non-optimal
249 location; if you don't like what it does, use jmemname.c.
250
251 * jmemname.c This version creates named temporary files. For anything
252 except a Unix machine, you'll need to configure the
253 select_file_name() routine appropriately; see the comments
254 near the head of jmemname.c. If you use this version, define
255 NEED_SIGNAL_CATCHER in jconfig.h to make sure the temp files
256 are removed if the program is aborted.
257
258 * jmemnobs.c (That stands for No Backing Store :-).) This will compile on
259 almost any system, but it assumes you have enough main memory
260 or virtual memory to hold the biggest images you work with.
261
262 * jmemdos.c This should be used with most 16-bit MS-DOS compilers.
263 See the system-specific notes about MS-DOS for more info.
264 IMPORTANT: if you use this, define USE_MSDOS_MEMMGR in
265 jconfig.h, and include the assembly file jmemdosa.asm in the
266 programs. The supplied makefiles and jconfig files for
267 16-bit MS-DOS compilers already do both.
268
269 * jmemmac.c Custom version for Apple Macintosh; see the system-specific
270 notes for Macintosh for more info.
271
272 To use a particular memory manager, change the SYSDEPMEM variable in your
273 makefile to equal the corresponding object file name (for example, jmemansi.o
274 or jmemansi.obj for jmemansi.c).
275
276 If you have plenty of (real or virtual) main memory, just use jmemnobs.c.
277 "Plenty" means about ten bytes for every pixel in the largest images
278 you plan to process, so a lot of systems don't meet this criterion.
279 If yours doesn't, try jmemansi.c first. If that doesn't compile, you'll have
280 to use jmemname.c; be sure to adjust select_file_name() for local conditions.
281 You may also need to change unlink() to remove() in close_backing_store().
282
283 Except with jmemnobs.c or jmemmac.c, you need to adjust the DEFAULT_MAX_MEM
284 setting to a reasonable value for your system (either by adding a #define for
285 DEFAULT_MAX_MEM to jconfig.h, or by adding a -D switch to the Makefile).
286 This value limits the amount of data space the program will attempt to
287 allocate. Code and static data space isn't counted, so the actual memory
288 needs for cjpeg or djpeg are typically 100 to 150Kb more than the max-memory
289 setting. Larger max-memory settings reduce the amount of I/O needed to
290 process a large image, but too large a value can result in "insufficient
291 memory" failures. On most Unix machines (and other systems with virtual
292 memory), just set DEFAULT_MAX_MEM to several million and forget it. At the
293 other end of the spectrum, for MS-DOS machines you probably can't go much
294 above 300K to 400K. (On MS-DOS the value refers to conventional memory only.
295 Extended/expanded memory is handled separately by jmemdos.c.)
296
297
298 BUILDING THE SOFTWARE
299 =====================
300
301 Now you should be able to compile the software. Just say "make" (or
302 whatever's necessary to start the compilation). Have a cup of coffee.
303
304 Here are some things that could go wrong:
305
306 If your compiler complains about undefined structures, you should be able to
307 shut it up by putting "#define INCOMPLETE_TYPES_BROKEN" in jconfig.h.
308
309 If you have trouble with missing system include files or inclusion of the
310 wrong ones, read jinclude.h. This shouldn't happen if you used configure
311 or ckconfig.c to set up jconfig.h.
312
313 There are a fair number of routines that do not use all of their parameters;
314 some compilers will issue warnings about this, which you can ignore. There
315 are also a few configuration checks that may give "unreachable code" warnings.
316 Any other warning deserves investigation.
317
318 If you don't have a getenv() library routine, define NO_GETENV.
319
320 Also see the system-specific hints, below.
321
322
323 TESTING THE SOFTWARE
324 ====================
325
326 As a quick test of functionality we've included a small sample image in
327 several forms:
328 testorig.jpg Starting point for the djpeg tests.
329 testimg.ppm The output of djpeg testorig.jpg
330 testimg.gif The output of djpeg -gif testorig.jpg
331 testimg.bmp The output of djpeg -bmp -colors 256 testorig.jpg
332 testimg.jpg The output of cjpeg testimg.ppm
333 testprog.jpg Progressive-mode equivalent of testorig.jpg.
334 testimgp.jpg The output of cjpeg -progressive -optimize testimg.ppm
335 (The first- and second-generation .jpg files aren't identical since the
336 default compression parameters are lossy.) If you can generate duplicates
337 of the testimg* files then you probably have working programs.
338
339 With most of the makefiles, "make test" will perform the necessary
340 comparisons.
341
342 If you're using a makefile that doesn't provide the test option, run djpeg
343 and cjpeg by hand and compare the output files to testimg* with whatever
344 binary file comparison tool you have. The files should be bit-for-bit
345 identical.
346
347 If the programs complain "MAX_ALLOC_CHUNK is wrong, please fix", then you
348 need to reduce MAX_ALLOC_CHUNK to a value that fits in type size_t.
349 Try adding "#define MAX_ALLOC_CHUNK 65520L" to jconfig.h. A less likely
350 configuration error is "ALIGN_TYPE is wrong, please fix": defining ALIGN_TYPE
351 as long should take care of that one.
352
353 If the cjpeg test run fails with "Missing Huffman code table entry", it's a
354 good bet that you needed to define RIGHT_SHIFT_IS_UNSIGNED. Go back to the
355 configuration step and run ckconfig.c. (This is a good plan for any other
356 test failure, too.)
357
358 If you are using Unix (one-file) command line style on a non-Unix system,
359 it's a good idea to check that binary I/O through stdin/stdout actually
360 works. You should get the same results from "djpeg <testorig.jpg >out.ppm"
361 as from "djpeg -outfile out.ppm testorig.jpg". Note that the makefiles all
362 use the latter style and therefore do not exercise stdin/stdout! If this
363 check fails, try recompiling with USE_SETMODE or USE_FDOPEN defined.
364 If it still doesn't work, better use two-file style.
365
366 If you chose a memory manager other than jmemnobs.c, you should test that
367 temporary-file usage works. Try "djpeg -bmp -colors 256 -max 0 testorig.jpg"
368 and make sure its output matches testimg.bmp. If you have any really large
369 images handy, try compressing them with -optimize and/or decompressing with
370 -colors 256 to make sure your DEFAULT_MAX_MEM setting is not too large.
371
372 NOTE: this is far from an exhaustive test of the JPEG software; some modules,
373 such as 1-pass color quantization, are not exercised at all. It's just a
374 quick test to give you some confidence that you haven't missed something
375 major.
376
377
378 INSTALLING THE SOFTWARE
379 =======================
380
381 Once you're done with the above steps, you can install the software by
382 copying the executable files (cjpeg, djpeg, jpegtran, rdjpgcom, and wrjpgcom)
383 to wherever you normally install programs. On Unix systems, you'll also want
384 to put the man pages (cjpeg.1, djpeg.1, jpegtran.1, rdjpgcom.1, wrjpgcom.1)
385 in the man-page directory. The pre-fab makefiles don't support this step
386 since there's such a wide variety of installation procedures on different
387 systems.
388
389 If you generated a Makefile with the "configure" script, you can just say
390 make install
391 to install the programs and their man pages into the standard places.
392 (You'll probably need to be root to do this.) We recommend first saying
393 make -n install
394 to see where configure thought the files should go. You may need to edit
395 the Makefile, particularly if your system's conventions for man page
396 filenames don't match what configure expects.
397
398 If you want to install the IJG library itself, for use in compiling other
399 programs besides ours, then you need to put the four include files
400 jpeglib.h jerror.h jconfig.h jmorecfg.h
401 into your include-file directory, and put the library file libjpeg.a
402 (extension may vary depending on system) wherever library files go.
403 If you generated a Makefile with "configure", it will do what it thinks
404 is the right thing if you say
405 make install-lib
406
407
408 OPTIONAL STUFF
409 ==============
410
411 Progress monitor:
412
413 If you like, you can #define PROGRESS_REPORT (in jconfig.h) to enable display
414 of percent-done progress reports. The routine provided in cdjpeg.c merely
415 prints percentages to stderr, but you can customize it to do something
416 fancier.
417
418 Utah RLE file format support:
419
420 We distribute the software with support for RLE image files (Utah Raster
421 Toolkit format) disabled, because the RLE support won't compile without the
422 Utah library. If you have URT version 3.1 or later, you can enable RLE
423 support as follows:
424 1. #define RLE_SUPPORTED in jconfig.h.
425 2. Add a -I option to CFLAGS in the Makefile for the directory
426 containing the URT .h files (typically the "include"
427 subdirectory of the URT distribution).
428 3. Add -L... -lrle to LDLIBS in the Makefile, where ... specifies
429 the directory containing the URT "librle.a" file (typically the
430 "lib" subdirectory of the URT distribution).
431
432 Support for 9-bit to 12-bit deep pixel data:
433
434 The IJG code currently allows 8, 9, 10, 11, or 12 bits sample data precision.
435 (For color, this means 8 to 12 bits per channel, of course.) If you need to
436 work with deeper than 8-bit data, you can compile the IJG code for 9-bit to
437 12-bit operation.
438 To do so:
439 1. In jmorecfg.h, define BITS_IN_JSAMPLE as 9, 10, 11, or 12 rather than 8.
440 2. In jconfig.h, undefine BMP_SUPPORTED, RLE_SUPPORTED, and TARGA_SUPPORTED,
441 because the code for those formats doesn't handle deeper than 8-bit data
442 and won't even compile. (The PPM code does work, as explained below.
443 The GIF code works too; it scales 8-bit GIF data to and from 12-bit
444 depth automatically.)
445 3. Compile. Don't expect "make test" to pass, since the supplied test
446 files are for 8-bit data.
447
448 Currently, 9-bit to 12-bit support does not work on 16-bit-int machines.
449
450 Run-time selection and conversion of data precision are currently not
451 supported and may be added later.
452 Exception: The transcoding part (jpegtran) supports all settings in a
453 single instance, since it operates on the level of DCT coefficients and
454 not sample values.
455
456 The PPM reader (rdppm.c) can read deeper than 8-bit data from either
457 text-format or binary-format PPM and PGM files. Binary-format PPM/PGM files
458 which have a maxval greater than 255 are assumed to use 2 bytes per sample,
459 MSB first (big-endian order). As of early 1995, 2-byte binary format is not
460 officially supported by the PBMPLUS library, but it is expected that a
461 future release of PBMPLUS will support it. Note that the PPM reader will
462 read files of any maxval regardless of the BITS_IN_JSAMPLE setting; incoming
463 data is automatically rescaled to maxval=MAXJSAMPLE as appropriate for the
464 cjpeg bit depth.
465
466 The PPM writer (wrppm.c) will normally write 2-byte binary PPM or PGM
467 format, maxval=MAXJSAMPLE, when compiled with BITS_IN_JSAMPLE>8. Since this
468 format is not yet widely supported, you can disable it by compiling wrppm.c
469 with PPM_NORAWWORD defined; then the data is scaled down to 8 bits to make a
470 standard 1-byte/sample PPM or PGM file. (Yes, this means still another copy
471 of djpeg to keep around. But hopefully you won't need it for very long.
472 Poskanzer's supposed to get that new PBMPLUS release out Real Soon Now.)
473
474 Of course, if you are working with 9-bit to 12-bit data, you probably have
475 it stored in some other, nonstandard format. In that case you'll probably
476 want to write your own I/O modules to read and write your format.
477
478 Note:
479 The standard Huffman tables are only valid for 8-bit data precision. If
480 you selected more than 8-bit data precision, cjpeg uses arithmetic coding
481 by default. The Huffman encoder normally uses entropy optimization to
482 compute usable tables for higher precision. Otherwise, you'll have to
483 supply different default Huffman tables.
484
485 Removing code:
486
487 If you need to make a smaller version of the JPEG software, some optional
488 functions can be removed at compile time. See the xxx_SUPPORTED #defines in
489 jconfig.h and jmorecfg.h. If at all possible, we recommend that you leave in
490 decoder support for all valid JPEG files, to ensure that you can read anyone's
491 output. Taking out support for image file formats that you don't use is the
492 most painless way to make the programs smaller. Another possibility is to
493 remove some of the DCT methods: in particular, the "IFAST" method may not be
494 enough faster than the others to be worth keeping on your machine. (If you
495 do remove ISLOW or IFAST, be sure to redefine JDCT_DEFAULT or JDCT_FASTEST
496 to a supported method, by adding a #define in jconfig.h.)
497
498
499 OPTIMIZATION
500 ============
501
502 Unless you own a Cray, you'll probably be interested in making the JPEG
503 software go as fast as possible. This section covers some machine-dependent
504 optimizations you may want to try. We suggest that before trying any of
505 this, you first get the basic installation to pass the self-test step.
506 Repeat the self-test after any optimization to make sure that you haven't
507 broken anything.
508
509 The integer DCT routines perform a lot of multiplications. These
510 multiplications must yield 32-bit results, but none of their input values
511 are more than 16 bits wide. On many machines, notably the 680x0 and 80x86
512 CPUs, a 16x16=>32 bit multiply instruction is faster than a full 32x32=>32
513 bit multiply. Unfortunately there is no portable way to specify such a
514 multiplication in C, but some compilers can generate one when you use the
515 right combination of casts. See the MULTIPLYxxx macro definitions in
516 jdct.h. If your compiler makes "int" be 32 bits and "short" be 16 bits,
517 defining SHORTxSHORT_32 is fairly likely to work. When experimenting with
518 alternate definitions, be sure to test not only whether the code still works
519 (use the self-test), but also whether it is actually faster --- on some
520 compilers, alternate definitions may compute the right answer, yet be slower
521 than the default. Timing cjpeg on a large PGM (grayscale) input file is the
522 best way to check this, as the DCT will be the largest fraction of the runtime
523 in that mode. (Note: some of the distributed compiler-specific jconfig files
524 already contain #define switches to select appropriate MULTIPLYxxx
525 definitions.)
526
527 If your machine has sufficiently fast floating point hardware, you may find
528 that the float DCT method is faster than the integer DCT methods, even
529 after tweaking the integer multiply macros. In that case you may want to
530 make the float DCT be the default method. (The only objection to this is
531 that float DCT results may vary slightly across machines.) To do that, add
532 "#define JDCT_DEFAULT JDCT_FLOAT" to jconfig.h. Even if you don't change
533 the default, you should redefine JDCT_FASTEST, which is the method selected
534 by djpeg's -fast switch. Don't forget to update the documentation files
535 (usage.txt and/or cjpeg.1, djpeg.1) to agree with what you've done.
536
537 If access to "short" arrays is slow on your machine, it may be a win to
538 define type JCOEF as int rather than short. This will cost a good deal of
539 memory though, particularly in some multi-pass modes, so don't do it unless
540 you have memory to burn and short is REALLY slow.
541
542 If your compiler can compile function calls in-line, make sure the INLINE
543 macro in jmorecfg.h is defined as the keyword that marks a function
544 inline-able. Some compilers have a switch that tells the compiler to inline
545 any function it thinks is profitable (e.g., -finline-functions for gcc).
546 Enabling such a switch is likely to make the compiled code bigger but faster.
547
548 In general, it's worth trying the maximum optimization level of your compiler,
549 and experimenting with any optional optimizations such as loop unrolling.
550 (Unfortunately, far too many compilers have optimizer bugs ... be prepared to
551 back off if the code fails self-test.) If you do any experimentation along
552 these lines, please report the optimal settings to jpeg-info@ijg.org so we
553 can mention them in future releases. Be sure to specify your machine and
554 compiler version.
555
556
557 HINTS FOR SPECIFIC SYSTEMS
558 ==========================
559
560 We welcome reports on changes needed for systems not mentioned here. Submit
561 'em to jpeg-info@ijg.org. Also, if configure or ckconfig.c is wrong about
562 how to configure the JPEG software for your system, please let us know.
563
564
565 Acorn RISC OS:
566
567 (Thanks to Simon Middleton for these hints on compiling with Desktop C.)
568 After renaming the files according to Acorn conventions, take a copy of
569 makefile.ansi, change all occurrences of 'libjpeg.a' to 'libjpeg.o' and
570 change these definitions as indicated:
571
572 CFLAGS= -throwback -IC: -Wn
573 LDLIBS=C:o.Stubs
574 SYSDEPMEM=jmemansi.o
575 LN=Link
576 AR=LibFile -c -o
577
578 Also add a new line '.c.o:; $(cc) $< $(cflags) -c -o $@'. Remove the
579 lines '$(RM) libjpeg.o' and '$(AR2) libjpeg.o' and the 'jconfig.h'
580 dependency section.
581
582 Copy jconfig.txt to jconfig.h. Edit jconfig.h to define TWO_FILE_COMMANDLINE
583 and CHAR_IS_UNSIGNED.
584
585 Run the makefile using !AMU not !Make. If you want to use the 'clean' and
586 'test' makefile entries then you will have to fiddle with the syntax a bit
587 and rename the test files.
588
589
590 Amiga:
591
592 SAS C 6.50 reportedly is too buggy to compile the IJG code properly.
593 A patch to update to 6.51 is available from SAS or AmiNet FTP sites.
594
595 The supplied config files are set up to use jmemname.c as the memory
596 manager, with temporary files being created on the device named by
597 "JPEGTMP:".
598
599
600 Atari ST/Mega/STE/TT/Falcon:
601
602 Copy the project files makcjpeg.st, makdjpeg.st, maktjpeg.st, and makljpeg.st
603 to cjpeg.prj, djpeg.prj, jpegtran.prj, and libjpeg.prj respectively. The
604 project files should work as-is with Pure C. For Turbo C, change library
605 filenames "pc..." to "tc..." in each project file. Note that libjpeg.prj
606 selects jmemansi.c as the recommended memory manager. You'll probably want to
607 adjust the DEFAULT_MAX_MEM setting --- you want it to be a couple hundred K
608 less than your normal free memory. Put "#define DEFAULT_MAX_MEM nnnn" into
609 jconfig.h to do this.
610
611 To use the 68881/68882 coprocessor for the floating point DCT, add the
612 compiler option "-8" to the project files and replace pcfltlib.lib with
613 pc881lib.lib in cjpeg.prj and djpeg.prj. Or if you don't have a
614 coprocessor, you may prefer to remove the float DCT code by undefining
615 DCT_FLOAT_SUPPORTED in jmorecfg.h (since without a coprocessor, the float
616 code will be too slow to be useful). In that case, you can delete
617 pcfltlib.lib from the project files.
618
619 Note that you must make libjpeg.lib before making cjpeg.ttp, djpeg.ttp,
620 or jpegtran.ttp. You'll have to perform the self-test by hand.
621
622 We haven't bothered to include project files for rdjpgcom and wrjpgcom.
623 Those source files should just be compiled by themselves; they don't
624 depend on the JPEG library. You can use the default.prj project file
625 of the Pure C distribution to make the programs.
626
627 There is a bug in some older versions of the Turbo C library which causes the
628 space used by temporary files created with "tmpfile()" not to be freed after
629 an abnormal program exit. If you check your disk afterwards, you will find
630 cluster chains that are allocated but not used by a file. This should not
631 happen in cjpeg/djpeg/jpegtran, since we enable a signal catcher to explicitly
632 close temp files before exiting. But if you use the JPEG library with your
633 own code, be sure to supply a signal catcher, or else use a different
634 system-dependent memory manager.
635
636
637 Cray:
638
639 Should you be so fortunate as to be running JPEG on a Cray YMP, there is a
640 compiler bug in old versions of Cray's Standard C (prior to 3.1). If you
641 still have an old compiler, you'll need to insert a line reading
642 "#pragma novector" just before the loop
643 for (i = 1; i <= (int) htbl->bits[l]; i++)
644 huffsize[p++] = (char) l;
645 in fix_huff_tbl (in V5beta1, line 204 of jchuff.c and line 176 of jdhuff.c).
646 [This bug may or may not still occur with the current IJG code, but it's
647 probably a dead issue anyway...]
648
649
650 HP-UX:
651
652 If you have HP-UX 7.05 or later with the "software development" C compiler,
653 you should run the compiler in ANSI mode. If using the configure script,
654 say
655 ./configure CC='cc -Aa'
656 (or -Ae if you prefer). If configuring by hand, use makefile.ansi and add
657 "-Aa" to the CFLAGS line in the makefile.
658
659 If you have a pre-7.05 system, or if you are using the non-ANSI C compiler
660 delivered with a minimum HP-UX system, then you must use makefile.unix
661 (and do NOT add -Aa); or just run configure without the CC option.
662
663 On HP 9000 series 800 machines, the HP C compiler is buggy in revisions prior
664 to A.08.07. If you get complaints about "not a typedef name", you'll have to
665 use makefile.unix, or run configure without the CC option.
666
667
668 Macintosh, generic comments:
669
670 The supplied user-interface files (cjpeg.c, djpeg.c, etc) are set up to
671 provide a Unix-style command line interface. You can use this interface on
672 the Mac by means of the ccommand() library routine provided by Metrowerks
673 CodeWarrior or Think C. This is only appropriate for testing the library,
674 however; to make a user-friendly equivalent of cjpeg/djpeg you'd really want
675 to develop a Mac-style user interface. There isn't a complete example
676 available at the moment, but there are some helpful starting points:
677 1. Sam Bushell's free "To JPEG" applet provides drag-and-drop conversion to
678 JPEG under System 7 and later. This only illustrates how to use the
679 compression half of the library, but it does a very nice job of that part.
680 The CodeWarrior source code is available from http://www.pobox.com/~jsam.
681 2. Jim Brunner prepared a Mac-style user interface for both compression and
682 decompression. Unfortunately, it hasn't been updated since IJG v4, and
683 the library's API has changed considerably since then. Still it may be of
684 some help, particularly as a guide to compiling the IJG code under Think C.
685 Jim's code is available from the Info-Mac archives, at sumex-aim.stanford.edu
686 or mirrors thereof; see file /info-mac/dev/src/jpeg-convert-c.hqx.
687
688 jmemmac.c is the recommended memory manager back end for Macintosh. It uses
689 NewPtr/DisposePtr instead of malloc/free, and has a Mac-specific
690 implementation of jpeg_mem_available(). It also creates temporary files that
691 follow Mac conventions. (That part of the code relies on System-7-or-later OS
692 functions. See the comments in jmemmac.c if you need to run it on System 6.)
693 NOTE that USE_MAC_MEMMGR must be defined in jconfig.h to use jmemmac.c.
694
695 You can also use jmemnobs.c, if you don't care about handling images larger
696 than available memory. If you use any memory manager back end other than
697 jmemmac.c, we recommend replacing "malloc" and "free" by "NewPtr" and
698 "DisposePtr", because Mac C libraries often have peculiar implementations of
699 malloc/free. (For instance, free() may not return the freed space to the
700 Mac Memory Manager. This is undesirable for the IJG code because jmemmgr.c
701 already clumps space requests.)
702
703
704 Macintosh, Metrowerks CodeWarrior:
705
706 The Unix-command-line-style interface can be used by defining USE_CCOMMAND.
707 You'll also need to define TWO_FILE_COMMANDLINE to avoid stdin/stdout.
708 This means that when using the cjpeg/djpeg programs, you'll have to type the
709 input and output file names in the "Arguments" text-edit box, rather than
710 using the file radio buttons. (Perhaps USE_FDOPEN or USE_SETMODE would
711 eliminate the problem, but I haven't heard from anyone who's tried it.)
712
713 On 680x0 Macs, Metrowerks defines type "double" as a 10-byte IEEE extended
714 float. jmemmgr.c won't like this: it wants sizeof(ALIGN_TYPE) to be a power
715 of 2. Add "#define ALIGN_TYPE long" to jconfig.h to eliminate the complaint.
716
717 The supplied configuration file jconfig.mac can be used for your jconfig.h;
718 it includes all the recommended symbol definitions. If you have AppleScript
719 installed, you can run the supplied script makeproj.mac to create CodeWarrior
720 project files for the library and the testbed applications, then build the
721 library and applications. (Thanks to Dan Sears and Don Agro for this nifty
722 hack, which saves us from trying to maintain CodeWarrior project files as part
723 of the IJG distribution...)
724
725
726 Macintosh, Think C:
727
728 The documentation in Jim Brunner's "JPEG Convert" source code (see above)
729 includes detailed build instructions for Think C; it's probably somewhat
730 out of date for the current release, but may be helpful.
731
732 If you want to build the minimal command line version, proceed as follows.
733 You'll have to prepare project files for the programs; we don't include any
734 in the distribution since they are not text files. Use the file lists in
735 any of the supplied makefiles as a guide. Also add the ANSI and Unix C
736 libraries in a separate segment. You may need to divide the JPEG files into
737 more than one segment; we recommend dividing compression and decompression
738 modules. Define USE_CCOMMAND in jconfig.h so that the ccommand() routine is
739 called. You must also define TWO_FILE_COMMANDLINE because stdin/stdout
740 don't handle binary data correctly.
741
742 On 680x0 Macs, Think C defines type "double" as a 12-byte IEEE extended float.
743 jmemmgr.c won't like this: it wants sizeof(ALIGN_TYPE) to be a power of 2.
744 Add "#define ALIGN_TYPE long" to jconfig.h to eliminate the complaint.
745
746 jconfig.mac should work as a jconfig.h configuration file for Think C,
747 but the makeproj.mac AppleScript script is specific to CodeWarrior. Sorry.
748
749
750 MIPS R3000:
751
752 MIPS's cc version 1.31 has a rather nasty optimization bug. Don't use -O
753 if you have that compiler version. (Use "cc -V" to check the version.)
754 Note that the R3000 chip is found in workstations from DEC and others.
755
756
757 MS-DOS, generic comments for 16-bit compilers:
758
759 The IJG code is designed to work well in 80x86 "small" or "medium" memory
760 models (i.e., data pointers are 16 bits unless explicitly declared "far";
761 code pointers can be either size). You may be able to use small model to
762 compile cjpeg or djpeg by itself, but you will probably have to use medium
763 model for any larger application. This won't make much difference in
764 performance. You *will* take a noticeable performance hit if you use a
765 large-data memory model, and you should avoid "huge" model if at all
766 possible. Be sure that NEED_FAR_POINTERS is defined in jconfig.h if you use
767 a small-data memory model; be sure it is NOT defined if you use a large-data
768 model. (The supplied makefiles and jconfig files for Borland and Microsoft C
769 compile in medium model and define NEED_FAR_POINTERS.)
770
771 The DOS-specific memory manager, jmemdos.c, should be used if possible.
772 It needs some assembly-code routines which are in jmemdosa.asm; make sure
773 your makefile assembles that file and includes it in the library. If you
774 don't have a suitable assembler, you can get pre-assembled object files for
775 jmemdosa by FTP from ftp.uu.net:/graphics/jpeg/jdosaobj.zip. (DOS-oriented
776 distributions of the IJG source code often include these object files.)
777
778 When using jmemdos.c, jconfig.h must define USE_MSDOS_MEMMGR and must set
779 MAX_ALLOC_CHUNK to less than 64K (65520L is a typical value). If your
780 C library's far-heap malloc() can't allocate blocks that large, reduce
781 MAX_ALLOC_CHUNK to whatever it can handle.
782
783 If you can't use jmemdos.c for some reason --- for example, because you
784 don't have an assembler to assemble jmemdosa.asm --- you'll have to fall
785 back to jmemansi.c or jmemname.c. You'll probably still need to set
786 MAX_ALLOC_CHUNK in jconfig.h, because most DOS C libraries won't malloc()
787 more than 64K at a time. IMPORTANT: if you use jmemansi.c or jmemname.c,
788 you will have to compile in a large-data memory model in order to get the
789 right stdio library. Too bad.
790
791 wrjpgcom needs to be compiled in large model, because it malloc()s a 64KB
792 work area to hold the comment text. If your C library's malloc can't
793 handle that, reduce MAX_COM_LENGTH as necessary in wrjpgcom.c.
794
795 Most MS-DOS compilers treat stdin/stdout as text files, so you must use
796 two-file command line style. But if your compiler has either fdopen() or
797 setmode(), you can use one-file style if you like. To do this, define
798 USE_SETMODE or USE_FDOPEN so that stdin/stdout will be set to binary mode.
799 (USE_SETMODE seems to work with more DOS compilers than USE_FDOPEN.) You
800 should test that I/O through stdin/stdout produces the same results as I/O
801 to explicitly named files... the "make test" procedures in the supplied
802 makefiles do NOT use stdin/stdout.
803
804
805 MS-DOS, generic comments for 32-bit compilers:
806
807 None of the above comments about memory models apply if you are using a
808 32-bit flat-memory-space environment, such as DJGPP or Watcom C. (And you
809 should use one if you have it, as performance will be much better than
810 8086-compatible code!) For flat-memory-space compilers, do NOT define
811 NEED_FAR_POINTERS, and do NOT use jmemdos.c. Use jmemnobs.c if the
812 environment supplies adequate virtual memory, otherwise use jmemansi.c or
813 jmemname.c.
814
815 You'll still need to be careful about binary I/O through stdin/stdout.
816 See the last paragraph of the previous section.
817
818
819 MS-DOS, Borland C:
820
821 Be sure to convert all the source files to DOS text format (CR/LF newlines).
822 Although Borland C will often work OK with unmodified Unix (LF newlines)
823 source files, sometimes it will give bogus compile errors.
824 "Illegal character '#'" is the most common such error. (This is true with
825 Borland C 3.1, but perhaps is fixed in newer releases.)
826
827 If you want one-file command line style, just undefine TWO_FILE_COMMANDLINE.
828 jconfig.bcc already includes #define USE_SETMODE to make this work.
829 (fdopen does not work correctly.)
830
831
832 MS-DOS, Microsoft C:
833
834 makefile.mc6 works with Microsoft C, DOS Visual C++, etc. It should only
835 be used if you want to build a 16-bit (small or medium memory model) program.
836
837 If you want one-file command line style, just undefine TWO_FILE_COMMANDLINE.
838 jconfig.mc6 already includes #define USE_SETMODE to make this work.
839 (fdopen does not work correctly.)
840
841 Note that this makefile assumes that the working copy of itself is called
842 "makefile". If you want to call it something else, say "makefile.mak",
843 be sure to adjust the dependency line that reads "$(RFILE) : makefile".
844 Otherwise the make will fail because it doesn't know how to create "makefile".
845 Worse, some releases of Microsoft's make utilities give an incorrect error
846 message in this situation.
847
848 Old versions of MS C fail with an "out of macro expansion space" error
849 because they can't cope with the macro TRACEMS8 (defined in jerror.h).
850 If this happens to you, the easiest solution is to change TRACEMS8 to
851 expand to nothing. You'll lose the ability to dump out JPEG coefficient
852 tables with djpeg -debug -debug, but at least you can compile.
853
854 Original MS C 6.0 is very buggy; it compiles incorrect code unless you turn
855 off optimization entirely (remove -O from CFLAGS). 6.00A is better, but it
856 still generates bad code if you enable loop optimizations (-Ol or -Ox).
857
858 MS C 8.0 crashes when compiling jquant1.c with optimization switch /Oo ...
859 which is on by default. To work around this bug, compile that one file
860 with /Oo-.
861
862
863 Microsoft Windows (all versions), generic comments:
864
865 Some Windows system include files define typedef boolean as "unsigned char".
866 The IJG code also defines typedef boolean, but we make it an "enum" by default.
867 This doesn't affect the IJG programs because we don't import those Windows
868 include files. But if you use the JPEG library in your own program, and some
869 of your program's files import one definition of boolean while some import the
870 other, you can get all sorts of mysterious problems. A good preventive step
871 is to make the IJG library use "unsigned char" for boolean. To do that,
872 add something like this to your jconfig.h file:
873 /* Define "boolean" as unsigned char, not enum, per Windows custom */
874 #ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
875 typedef unsigned char boolean;
876 #endif
877 #ifndef FALSE /* in case these macros already exist */
878 #define FALSE 0 /* values of boolean */
879 #endif
880 #ifndef TRUE
881 #define TRUE 1
882 #endif
883 #define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
884 (This is already in jconfig.vc, by the way.)
885
886 windef.h contains the declarations
887 #define far
888 #define FAR far
889 Since jmorecfg.h tries to define FAR as empty, you may get a compiler
890 warning if you include both jpeglib.h and windef.h (which windows.h
891 includes). To suppress the warning, you can put "#ifndef FAR"/"#endif"
892 around the line "#define FAR" in jmorecfg.h.
893 (Something like this is already in jmorecfg.h, by the way.)
894
895 When using the library in a Windows application, you will almost certainly
896 want to modify or replace the error handler module jerror.c, since our
897 default error handler does a couple of inappropriate things:
898 1. it tries to write error and warning messages on stderr;
899 2. in event of a fatal error, it exits by calling exit().
900
901 A simple stopgap solution for problem 1 is to replace the line
902 fprintf(stderr, "%s\n", buffer);
903 (in output_message in jerror.c) with
904 MessageBox(GetActiveWindow(),buffer,"JPEG Error",MB_OK|MB_ICONERROR);
905 It's highly recommended that you at least do that much, since otherwise
906 error messages will disappear into nowhere. (Beginning with IJG v6b, this
907 code is already present in jerror.c; just define USE_WINDOWS_MESSAGEBOX in
908 jconfig.h to enable it.)
909
910 The proper solution for problem 2 is to return control to your calling
911 application after a library error. This can be done with the setjmp/longjmp
912 technique discussed in libjpeg.txt and illustrated in example.c. (NOTE:
913 some older Windows C compilers provide versions of setjmp/longjmp that
914 don't actually work under Windows. You may need to use the Windows system
915 functions Catch and Throw instead.)
916
917 The recommended memory manager under Windows is jmemnobs.c; in other words,
918 let Windows do any virtual memory management needed. You should NOT use
919 jmemdos.c nor jmemdosa.asm under Windows.
920
921 For Windows 3.1, we recommend compiling in medium or large memory model;
922 for newer Windows versions, use a 32-bit flat memory model. (See the MS-DOS
923 sections above for more info about memory models.) In the 16-bit memory
924 models only, you'll need to put
925 #define MAX_ALLOC_CHUNK 65520L /* Maximum request to malloc() */
926 into jconfig.h to limit allocation chunks to 64Kb. (Without that, you'd
927 have to use huge memory model, which slows things down unnecessarily.)
928 jmemnobs.c works without modification in large or flat memory models, but to
929 use medium model, you need to modify its jpeg_get_large and jpeg_free_large
930 routines to allocate far memory. In any case, you might like to replace
931 its calls to malloc and free with direct calls on Windows memory allocation
932 functions.
933
934 You may also want to modify jdatasrc.c and jdatadst.c to use Windows file
935 operations rather than fread/fwrite. This is only necessary if your C
936 compiler doesn't provide a competent implementation of C stdio functions.
937
938 You might want to tweak the RGB_xxx macros in jmorecfg.h so that the library
939 will accept or deliver color pixels in BGR sample order, not RGB; BGR order
940 is usually more convenient under Windows. Note that this change will break
941 the sample applications cjpeg/djpeg, but the library itself works fine.
942
943
944 Many people want to convert the IJG library into a DLL. This is reasonably
945 straightforward, but watch out for the following:
946
947 1. Don't try to compile as a DLL in small or medium memory model; use
948 large model, or even better, 32-bit flat model. Many places in the IJG code
949 assume the address of a local variable is an ordinary (not FAR) pointer;
950 that isn't true in a medium-model DLL.
951
952 2. Microsoft C cannot pass file pointers between applications and DLLs.
953 (See Microsoft Knowledge Base, PSS ID Number Q50336.) So jdatasrc.c and
954 jdatadst.c don't work if you open a file in your application and then pass
955 the pointer to the DLL. One workaround is to make jdatasrc.c/jdatadst.c
956 part of your main application rather than part of the DLL.
957
958 3. You'll probably need to modify the macros GLOBAL() and EXTERN() to
959 attach suitable linkage keywords to the exported routine names. Similarly,
960 you'll want to modify METHODDEF() and JMETHOD() to ensure function pointers
961 are declared in a way that lets application routines be called back through
962 the function pointers. These macros are in jmorecfg.h. Typical definitions
963 for a 16-bit DLL are:
964 #define GLOBAL(type) type _far _pascal _loadds _export
965 #define EXTERN(type) extern type _far _pascal _loadds
966 #define METHODDEF(type) static type _far _pascal
967 #define JMETHOD(type,methodname,arglist) \
968 type (_far _pascal *methodname) arglist
969 For a 32-bit DLL you may want something like
970 #define GLOBAL(type) __declspec(dllexport) type
971 #define EXTERN(type) extern __declspec(dllexport) type
972 Although not all the GLOBAL routines are actually intended to be called by
973 the application, the performance cost of making them all DLL entry points is
974 negligible.
975
976 The unmodified IJG library presents a very C-specific application interface,
977 so the resulting DLL is only usable from C or C++ applications. There has
978 been some talk of writing wrapper code that would present a simpler interface
979 usable from other languages, such as Visual Basic. This is on our to-do list
980 but hasn't been very high priority --- any volunteers out there?
981
982
983 Microsoft Windows, Borland C:
984
985 The provided jconfig.bcc should work OK in a 32-bit Windows environment,
986 but you'll need to tweak it in a 16-bit environment (you'd need to define
987 NEED_FAR_POINTERS and MAX_ALLOC_CHUNK). Beware that makefile.bcc will need
988 alteration if you want to use it for Windows --- in particular, you should
989 use jmemnobs.c not jmemdos.c under Windows.
990
991 Borland C++ 4.5 fails with an internal compiler error when trying to compile
992 jdmerge.c in 32-bit mode. If enough people complain, perhaps Borland will fix
993 it. In the meantime, the simplest known workaround is to add a redundant
994 definition of the variable range_limit in h2v1_merged_upsample(), at the head
995 of the block that handles odd image width (about line 268 in v6 jdmerge.c):
996 /* If image width is odd, do the last output column separately */
997 if (cinfo->output_width & 1) {
998 register JSAMPLE * range_limit = cinfo->sample_range_limit; /* ADD THIS */
999 cb = GETJSAMPLE(*inptr1);
1000 Pretty bizarre, especially since the very similar routine h2v2_merged_upsample
1001 doesn't trigger the bug.
1002 Recent reports suggest that this bug does not occur with "bcc32a" (the
1003 Pentium-optimized version of the compiler).
1004
1005 Another report from a user of Borland C 4.5 was that incorrect code (leading
1006 to a color shift in processed images) was produced if any of the following
1007 optimization switch combinations were used:
1008 -Ot -Og
1009 -Ot -Op
1010 -Ot -Om
1011 So try backing off on optimization if you see such a problem. (Are there
1012 several different releases all numbered "4.5"??)
1013
1014
1015 Microsoft Windows, Microsoft Visual C++:
1016
1017 jconfig.vc should work OK with any Microsoft compiler for a 32-bit memory
1018 model. makefile.vc is intended for command-line use. (If you are using
1019 the Developer Studio environment, you may prefer the DevStudio project
1020 files; see below.)
1021
1022 IJG JPEG 7 adds extern "C" to jpeglib.h. This avoids the need to put
1023 extern "C" { ... } around #include "jpeglib.h" in your C++ application.
1024 You can also force VC++ to treat the library as C++ code by renaming
1025 all the *.c files to *.cpp (and adjusting the makefile to match).
1026 In this case you also need to define the symbol DONT_USE_EXTERN_C in
1027 the configuration to prevent jpeglib.h from using extern "C".
1028
1029
1030 Microsoft Windows, Microsoft Visual C++ 6 Developer Studio:
1031
1032 We include makefiles that should work as project files in Developer Studio
1033 6.0 or later. There is a library makefile that builds the IJG library as
1034 a static Win32 library, and application makefiles that build the sample
1035 applications as Win32 console applications. (Even if you only want the
1036 library, we recommend building the applications so that you can run the
1037 self-test.)
1038
1039 To use:
1040 1. Open the Windows Command Prompt, change to the source directory and
1041 execute the command line
1042 nmake /f makefile.vs setup-vc6
1043 If you get an error message saying that the "nmake" command could
1044 not be found, execute the command
1045 "%ProgramFiles%\Microsoft Visual Studio\VC98\Bin\VCVARS32"
1046 to set the environment for using Microsoft Visual C++ tools,
1047 and repeat the nmake call.
1048 This will move jconfig.vc to jconfig.h and makefiles to project files.
1049 (Note that the renaming is critical!)
1050 Alternatively you can use
1051 nmake /f makefile.vs setupcopy-vc6
1052 This will create renamed copies of the files,
1053 which allows to repeat the setup later.
1054 2. Open the workspace file jpeg.dsw, build the library project.
1055 (If you are using Developer Studio more recent than 6.0, you'll
1056 probably get a message saying that the project files are being updated.)
1057 3. Open the workspace file apps.dsw, build the application projects.
1058 4. To perform the self-test, execute the command line
1059 nmake /f makefile.vs test-build
1060 5. Move the application .exe files from the Release folder to an
1061 appropriate location on your path.
1062
1063
1064 Microsoft Windows, Microsoft Visual Studio 2019-2022 version 16-17:
1065
1066 We include makefiles that should work as project files in Visual Studio
1067 2019-2022 version 16-17 or later. There is a library makefile that
1068 builds the IJG library as a static Win32/x64/ARM/ARM64/ARM64EC library,
1069 and application makefiles that build the sample applications as
1070 Win32/x64/ARM/ARM64/ARM64EC console applications. (Even if you
1071 only want the library, we recommend building the applications
1072 so that you can run the self-test.)
1073
1074 To use:
1075 1. Ensure you’ve checked the item "Desktop development with C++" in the
1076 Workloads tab of Visual Studio Installer.
1077 Open the Developer Command Prompt for VS 2019-2022, change to the
1078 source directory and execute the command line
1079 nmake /f makefile.vs setup-v16
1080 This will move jconfig.vc to jconfig.h and makefiles to project files.
1081 (Note that the renaming is critical!)
1082 Alternatively you can use
1083 nmake /f makefile.vs setupcopy-v16
1084 This will create renamed copies of the files,
1085 which allows to repeat the setup later.
1086 2. Open the solution file jpeg.sln, build the library project.
1087 a) If you are using Visual Studio more recent than
1088 2022 version 17, you'll possibly get a message
1089 saying that the project files are being updated.
1090 b) If necessary, open the project properties and adapt the
1091 Windows Target Platform Version (or Windows SDK Version)
1092 in the Configuration Properties, General section.
1093 c) If you get a warning saying that a platform cannot be found,
1094 you can either
1095 * forgo the platform and ignore the warning, or
1096 * remove the platform in the Configuration Manager, or
1097 * install the corresponding platform build tools in
1098 Visual Studio Installer (Workloads tab Optional components
1099 or Individual components tab).
1100 d) If you want to build x64 code, change the platform setting from
1101 Win32 to x64. You can build Win32 and x64 versions side by side.
1102 e) If you want to build ARM/ARM64/ARM64EC code, change the platform
1103 setting to ARM/ARM64/ARM64EC. Ensure you’ve installed the
1104 ARM/ARM64/ARM64EC build tools in Visual Studio Installer
1105 (Workloads tab Optional components or Individual components tab).
1106 You can build Win32/x64/ARM/ARM64/ARM64EC versions side by side.
1107 3. Open the solution file apps.sln, build the application projects.
1108 4. To perform the self-test, execute the command line
1109 nmake /f makefile.vs test-32
1110 for the Win32 build, or on a 64-bit system
1111 nmake /f makefile.vs test-64
1112 for the x64 build.
1113 Note: test options for ARM code will be added
1114 as soon as Windows on ARM reference devices are available.
1115 To date there are no Windows on ARM reference devices available.
1116 5. Move the application .exe files from the Release folder to an
1117 appropriate location on your path.
1118
1119
1120 Microsoft Windows, Embarcadero C++Builder/RAD Studio 10.4-11:
1121
1122 We include makefiles that should work as project files in C++Builder/RAD
1123 Studio 10.4-11 or later. There is a library makefile that builds the
1124 IJG library as a static Win32/Win64 library, and application makefiles
1125 that build the sample applications as Win32/Win64 console applications.
1126 (Even if you only want the library, we recommend building the
1127 applications so that you can run the self-test.)
1128
1129 To use:
1130 1. Open the RAD Studio Command Prompt (or the standard Windows Command
1131 Prompt, since the environment is set system-wide during RAD Studio
1132 installation), change to the source directory and execute the command
1133 line
1134 make -fmakefile.b32 setup-cb
1135 This will move jconfig.vc to jconfig.h and makefiles to project files.
1136 (Note that the renaming is critical!)
1137 Alternatively you can use
1138 make -fmakefile.b32 setupcopy-cb
1139 This will create renamed copies of the files,
1140 which allows to repeat the setup later.
1141 (You can use one of the other makefiles .c32,
1142 .d32, .x32, or .b64 instead of .b32.)
1143 2. Open the project file jpeg.cbproj, build the library project.
1144 a) By default, the classic Borland compiler (bcc32) is used for
1145 the Win32 build. To enable the Clang-based compiler for a
1146 specific project, select Project > Options > C++ Compiler
1147 and deselect the Use classic Borland compiler option.
1148 b) If you want to build Win64 code, change the platform setting
1149 from Windows 32 Bit to Windows 64 Bit.
1150 You can build Win32 and Win64 versions side by side.
1151 3. Open the project group file apps.groupproj,
1152 build the application projects.
1153 4. To perform the self-test, execute the command line
1154 make -fmakefile.b32 test-32
1155 for the Win32 build, or on a 64-bit system
1156 make -fmakefile.b32 test-64
1157 for the Win64 build.
1158 5. Move the application .exe files from the Release folder to an
1159 appropriate location on your path.
1160
1161
1162 OS/2, Borland C++:
1163
1164 Watch out for optimization bugs in older Borland compilers; you may need
1165 to back off the optimization switch settings. See the comments in
1166 makefile.bcc.
1167
1168
1169 SGI:
1170
1171 On some SGI systems, you may need to set "AR2= ar -ts" in the Makefile.
1172 If you are using configure, you can do this by saying
1173 ./configure RANLIB='ar -ts'
1174 This change is not needed on all SGIs. Use it only if the make fails at the
1175 stage of linking the completed programs.
1176
1177 On the MIPS R4000 architecture (Indy, etc.), the compiler option "-mips2"
1178 reportedly speeds up the float DCT method substantially, enough to make it
1179 faster than the default int method (but still slower than the fast int
1180 method). If you use -mips2, you may want to alter the default DCT method to
1181 be float. To do this, put "#define JDCT_DEFAULT JDCT_FLOAT" in jconfig.h.
1182
1183
1184 VMS:
1185
1186 On an Alpha/VMS system with MMS, be sure to use the "/Marco=Alpha=1"
1187 qualifier with MMS when building the JPEG package.
1188
1189 VAX/VMS v5.5-1 may have problems with the test step of the build procedure
1190 reporting differences when it compares the original and test images. If the
1191 error points to the last block of the files, it is most likely bogus and may
1192 be safely ignored. It seems to be because the files are Stream_LF and
1193 Backup/Compare has difficulty with the (presumably) null padded files.
1194 This problem was not observed on VAX/VMS v6.1 or AXP/VMS v6.1.