diff --git a/README b/README index 3b05e58..fa69a18 100644 --- a/README +++ b/README @@ -1,8 +1,8 @@ The Independent JPEG Group's JPEG software ========================================== -README for release 6 of 2-Aug-95 -================================ +README for release 6a of 7-Feb-96 +================================= This distribution contains the sixth public release of the Independent JPEG Group's free JPEG software. You are welcome to redistribute this software and @@ -126,7 +126,7 @@ with respect to this software, its quality, accuracy, merchantability, or fitness for a particular purpose. This software is provided "AS IS", and you, its user, assume the entire risk as to its quality and accuracy. -This software is copyright (C) 1991, 1992, 1993, 1994, 1995, Thomas G. Lane. +This software is copyright (C) 1991-1996, Thomas G. Lane. All Rights Reserved except as specified below. Permission is hereby granted to use, copy, modify, and distribute this @@ -227,23 +227,25 @@ and draft DIS 10918-2). This is by far the most complete exposition of JPEG in existence, and we highly recommend it. The JPEG standard itself is not available electronically; you must order a -paper copy through ISO. (Unless you feel a need to own a certified official -copy, we recommend buying the Pennebaker and Mitchell book instead; it's much -cheaper and includes a great deal of useful explanatory material.) In the US, -copies of the standard may be ordered from ANSI Sales at (212) 642-4900, or -from Global Engineering Documents at (800) 854-7179. (ANSI doesn't take -credit card orders, but Global does.) It's not cheap: as of 1992, ANSI was -charging $95 for Part 1 and $47 for Part 2, plus 7% shipping/handling. The -standard is divided into two parts, Part 1 being the actual specification, -while Part 2 covers compliance testing methods. Part 1 is titled "Digital -Compression and Coding of Continuous-tone Still Images, Part 1: Requirements -and guidelines" and has document number ISO/IEC IS 10918-1. Part 2 is titled -"Digital Compression and Coding of Continuous-tone Still Images, Part 2: -Compliance testing" and has document number ISO/IEC IS 10918-2. +paper copy through ISO or ITU. (Unless you feel a need to own a certified +official copy, we recommend buying the Pennebaker and Mitchell book instead; +it's much cheaper and includes a great deal of useful explanatory material.) +In the USA, copies of the standard may be ordered from ANSI Sales at (212) +642-4900, or from Global Engineering Documents at (800) 854-7179. (ANSI +doesn't take credit card orders, but Global does.) It's not cheap: as of +1992, ANSI was charging $95 for Part 1 and $47 for Part 2, plus 7% +shipping/handling. The standard is divided into two parts, Part 1 being the +actual specification, while Part 2 covers compliance testing methods. Part 1 +is titled "Digital Compression and Coding of Continuous-tone Still Images, +Part 1: Requirements and guidelines" and has document numbers ISO/IEC IS +10918-1, ITU-T T.81. Part 2 is titled "Digital Compression and Coding of +Continuous-tone Still Images, Part 2: Compliance testing" and has document +numbers ISO/IEC IS 10918-2, ITU-T T.83. -Extensions to the original JPEG standard are defined in Part 3, a new ISO +Extensions to the original JPEG standard are defined in JPEG Part 3, a new ISO document. Part 3 is undergoing ISO balloting and is expected to be approved -by the end of 1995. IJG currently does not support any Part 3 extensions. +by the end of 1995; it will have document numbers ISO/IEC IS 10918-3, ITU-T +T.84. IJG currently does not support any Part 3 extensions. The JPEG standard does not specify all details of an interchangeable file format. For the omitted details we follow the "JFIF" conventions, revision @@ -279,26 +281,24 @@ ARCHIVE LOCATIONS The "official" archive site for this software is ftp.uu.net (Internet address 192.48.96.9). The most recent released version can always be found there in directory graphics/jpeg. This particular version will be archived -as graphics/jpeg/jpegsrc.v6.tar.gz. If you are on the Internet, you +as graphics/jpeg/jpegsrc.v6a.tar.gz. If you are on the Internet, you can retrieve files from ftp.uu.net by standard anonymous FTP. If you don't have FTP access, UUNET's archives are also available via UUCP; contact help@uunet.uu.net for information on retrieving files that way. -Numerous Internet sites maintain copies of the UUNET files; in particular, -you can probably find a copy at any site that archives comp.sources.misc -submissions. However, only ftp.uu.net is guaranteed to have the latest -official version. +Numerous Internet sites maintain copies of the UUNET files. However, only +ftp.uu.net is guaranteed to have the latest official version. You can also obtain this software in DOS-compatible "zip" archive format from the SimTel archives (ftp.coast.net:/SimTel/msdos/graphics/), or on CompuServe -in the GRAPHSUPPORT forum (GO GRAPHSUP), library 12 "JPEG Tools". Again, -these versions may sometimes lag behind the ftp.uu.net release. +in the Graphics Support forum (GO CIS:GRAPHSUP), library 12 "JPEG Tools". +Again, these versions may sometimes lag behind the ftp.uu.net release. The JPEG FAQ (Frequently Asked Questions) article is a useful source of general information about JPEG. It is updated constantly and therefore is not included in this distribution. The FAQ is posted every two weeks to -Usenet newsgroups comp.graphics, news.answers, and other groups. You can -always obtain the latest version from the news.answers archive at +Usenet newsgroups comp.graphics.misc, news.answers, and other groups. +You can always obtain the latest version from the news.answers archive at rtfm.mit.edu. By FTP, fetch /pub/usenet/news.answers/jpeg-faq/part1 and .../part2. If you don't have FTP, send e-mail to mail-server@rtfm.mit.edu with body diff --git a/ansi2knr.1 b/ansi2knr.1 index 434ce8f..f9ee5a6 100644 --- a/ansi2knr.1 +++ b/ansi2knr.1 @@ -1,19 +1,36 @@ -.TH ANSI2KNR 1 "31 December 1990" +.TH ANSI2KNR 1 "19 Jan 1996" .SH NAME ansi2knr \- convert ANSI C to Kernighan & Ritchie C .SH SYNOPSIS .I ansi2knr -input_file output_file +[--varargs] input_file [output_file] .SH DESCRIPTION If no output_file is supplied, output goes to stdout. .br There are no error messages. .sp .I ansi2knr -recognizes functions by seeing a non-keyword identifier at the left margin, followed by a left parenthesis, with a right parenthesis as the last character on the line. It will recognize a multi-line header if the last character on each line but the last is a left parenthesis or comma. These algorithms ignore whitespace and comments, except that the function name must be the first thing on the line. +recognizes function definitions by seeing a non-keyword identifier at the left +margin, followed by a left parenthesis, with a right parenthesis as the last +character on the line, and with a left brace as the first token on the +following line (ignoring possible intervening comments). It will recognize a +multi-line header provided that no intervening line ends with a left or right +brace or a semicolon. These algorithms ignore whitespace and comments, except +that the function name must be the first thing on the line. .sp The following constructs will confuse it: .br - - Any other construct that starts at the left margin and follows the above syntax (such as a macro or function call). + - Any other construct that starts at the left margin and follows the +above syntax (such as a macro or function call). .br - - Macros that tinker with the syntax of the function header. + - Some macros that tinker with the syntax of the function header. +.sp +The --varargs switch is obsolete, and is recognized only for +backwards compatibility. The present version of +.I ansi2knr +will always attempt to convert a ... argument to va_alist and va_dcl. +.SH AUTHOR +L. Peter Deutsch wrote the original ansi2knr and +continues to maintain the current version; most of the code in the current +version is his work. ansi2knr also includes contributions by Francois +Pinard and Jim Avera . diff --git a/ansi2knr.c b/ansi2knr.c index f72d790..4e05fc2 100644 --- a/ansi2knr.c +++ b/ansi2knr.c @@ -1,7 +1,5 @@ -/* Copyright (C) 1989, 1991, 1993 Aladdin Enterprises. All rights reserved. */ - /* ansi2knr.c */ -/* Convert ANSI function declarations to K&R syntax */ +/* Convert ANSI C function definitions to K&R ("traditional C") syntax */ /* ansi2knr is distributed in the hope that it will be useful, but WITHOUT ANY @@ -28,7 +26,7 @@ program under the GPL. */ /* ----------- Here is the GNU GPL file COPYING, referred to above ---------- +---------- Here is the GNU GPL file COPYLEFT, referred to above ---------- ----- These terms do NOT apply to the JPEG software itself; see README ------ GHOSTSCRIPT GENERAL PUBLIC LICENSE @@ -174,59 +172,142 @@ PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) GHOSTSCRIPT, EVEN IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY. --------------------- End of file COPYING ------------------------------ +-------------------- End of file COPYLEFT ------------------------------ */ - -#include -#include - -#ifdef BSD -#include -#else -#ifdef VMS - extern int strlen(), strncmp(); -#else -#include -#endif -#endif - -/* malloc and free should be declared in stdlib.h, */ -/* but if you've got a K&R compiler, they probably aren't. */ -#ifdef MSDOS -#include -#else -#ifdef VMS - extern char *malloc(); - extern void free(); -#else - extern char *malloc(); - extern int free(); -#endif -#endif - -/* Usage: +/* + * Usage: ansi2knr input_file [output_file] * If no output_file is supplied, output goes to stdout. * There are no error messages. * - * ansi2knr recognizes functions by seeing a non-keyword identifier - * at the left margin, followed by a left parenthesis, - * with a right parenthesis as the last character on the line. - * It will recognize a multi-line header provided that the last character - * of the last line of the header is a right parenthesis, - * and no intervening line ends with a left brace or a semicolon. + * ansi2knr recognizes function definitions by seeing a non-keyword + * identifier at the left margin, followed by a left parenthesis, + * with a right parenthesis as the last character on the line, + * and with a left brace as the first token on the following line + * (ignoring possible intervening comments). + * It will recognize a multi-line header provided that no intervening + * line ends with a left or right brace or a semicolon. * These algorithms ignore whitespace and comments, except that * the function name must be the first thing on the line. * The following constructs will confuse it: * - Any other construct that starts at the left margin and * follows the above syntax (such as a macro or function call). - * - Macros that tinker with the syntax of the function header. + * - Some macros that tinker with the syntax of the function header. */ +/* + * The original and principal author of ansi2knr is L. Peter Deutsch + * . Other authors are noted in the change history + * that follows (in reverse chronological order): + lpd 96-01-21 added code to cope with not HAVE_CONFIG_H and with + compilers that don't understand void, as suggested by + Tom Lane + lpd 96-01-15 changed to require that the first non-comment token + on the line following a function header be a left brace, + to reduce sensitivity to macros, as suggested by Tom Lane + + lpd 95-06-22 removed #ifndefs whose sole purpose was to define + undefined preprocessor symbols as 0; changed all #ifdefs + for configuration symbols to #ifs + lpd 95-04-05 changed copyright notice to make it clear that + including ansi2knr in a program does not bring the entire + program under the GPL + lpd 94-12-18 added conditionals for systems where ctype macros + don't handle 8-bit characters properly, suggested by + Francois Pinard ; + removed --varargs switch (this is now the default) + lpd 94-10-10 removed CONFIG_BROKETS conditional + lpd 94-07-16 added some conditionals to help GNU `configure', + suggested by Francois Pinard ; + properly erase prototype args in function parameters, + contributed by Jim Avera ; + correct error in writeblanks (it shouldn't erase EOLs) + lpd 89-xx-xx original version + */ + +/* Most of the conditionals here are to make ansi2knr work with */ +/* or without the GNU configure machinery. */ + +#if HAVE_CONFIG_H +# include +#endif + +#include +#include + +#if HAVE_CONFIG_H + +/* + For properly autoconfiguring ansi2knr, use AC_CONFIG_HEADER(config.h). + This will define HAVE_CONFIG_H and so, activate the following lines. + */ + +# if STDC_HEADERS || HAVE_STRING_H +# include +# else +# include +# endif + +#else /* not HAVE_CONFIG_H */ + +/* Otherwise do it the hard way */ + +# ifdef BSD +# include +# else +# ifdef VMS + extern int strlen(), strncmp(); +# else +# include +# endif +# endif + +#endif /* not HAVE_CONFIG_H */ + +#if STDC_HEADERS +# include +#else +/* + malloc and free should be declared in stdlib.h, + but if you've got a K&R compiler, they probably aren't. + */ +# ifdef MSDOS +# include +# else +# ifdef VMS + extern char *malloc(); + extern void free(); +# else + extern char *malloc(); + extern int free(); +# endif +# endif + +#endif + +/* + * The ctype macros don't always handle 8-bit characters correctly. + * Compensate for this here. + */ +#ifdef isascii +# undef HAVE_ISASCII /* just in case */ +# define HAVE_ISASCII 1 +#else +#endif +#if STDC_HEADERS || !HAVE_ISASCII +# define is_ascii(c) 1 +#else +# define is_ascii(c) isascii(c) +#endif + +#define is_space(c) (is_ascii(c) && isspace(c)) +#define is_alpha(c) (is_ascii(c) && isalpha(c)) +#define is_alnum(c) (is_ascii(c) && isalnum(c)) + /* Scanning macros */ -#define isidchar(ch) (isalnum(ch) || (ch) == '_') -#define isidfirstchar(ch) (isalpha(ch) || (ch) == '_') +#define isidchar(ch) (is_alnum(ch) || (ch) == '_') +#define isidfirstchar(ch) (is_alpha(ch) || (ch) == '_') /* Forward references */ char *skipspace(); @@ -235,6 +316,7 @@ int test1(); int convert1(); /* The main program */ +int main(argc, argv) int argc; char *argv[]; @@ -242,46 +324,99 @@ main(argc, argv) #define bufsize 5000 /* arbitrary size */ char *buf; char *line; + char *more; + /* + * In previous versions, ansi2knr recognized a --varargs switch. + * If this switch was supplied, ansi2knr would attempt to convert + * a ... argument to va_alist and va_dcl; if this switch was not + * supplied, ansi2knr would simply drop any such arguments. + * Now, ansi2knr always does this conversion, and we only + * check for this switch for backward compatibility. + */ + int convert_varargs = 1; + + if ( argc > 1 && argv[1][0] == '-' ) + { if ( !strcmp(argv[1], "--varargs") ) + { convert_varargs = 1; + argc--; + argv++; + } + else + { fprintf(stderr, "Unrecognized switch: %s\n", argv[1]); + exit(1); + } + } switch ( argc ) { default: printf("Usage: ansi2knr input_file [output_file]\n"); exit(0); case 2: - out = stdout; break; + out = stdout; + break; case 3: out = fopen(argv[2], "w"); if ( out == NULL ) - { fprintf(stderr, "Cannot open %s\n", argv[2]); + { fprintf(stderr, "Cannot open output file %s\n", argv[2]); exit(1); } } in = fopen(argv[1], "r"); if ( in == NULL ) - { fprintf(stderr, "Cannot open %s\n", argv[1]); + { fprintf(stderr, "Cannot open input file %s\n", argv[1]); exit(1); } fprintf(out, "#line 1 \"%s\"\n", argv[1]); buf = malloc(bufsize); line = buf; while ( fgets(line, (unsigned)(buf + bufsize - line), in) != NULL ) - { switch ( test1(buf) ) + { +test: line += strlen(line); + switch ( test1(buf) ) { + case 2: /* a function header */ + convert1(buf, out, 1, convert_varargs); + break; case 1: /* a function */ - convert1(buf, out); + /* Check for a { at the start of the next line. */ + more = ++line; +f: if ( line >= buf + (bufsize - 1) ) /* overflow check */ + goto wl; + if ( fgets(line, (unsigned)(buf + bufsize - line), in) == NULL ) + goto wl; + switch ( *skipspace(more, 1) ) + { + case '{': + /* Definitely a function header. */ + convert1(buf, out, 0, convert_varargs); + fputs(more, out); + break; + case 0: + /* The next line was blank or a comment: */ + /* keep scanning for a non-comment. */ + line += strlen(line); + goto f; + default: + /* buf isn't a function header, but */ + /* more might be. */ + fputs(buf, out); + strcpy(buf, more); + line = buf; + goto test; + } break; case -1: /* maybe the start of a function */ - line = buf + strlen(buf); if ( line != buf + (bufsize - 1) ) /* overflow check */ - continue; + continue; /* falls through */ default: /* not a function */ - fputs(buf, out); +wl: fputs(buf, out); break; } line = buf; } - if ( line != buf ) fputs(buf, out); + if ( line != buf ) + fputs(buf, out); free(buf); fclose(out); fclose(in); @@ -294,11 +429,14 @@ skipspace(p, dir) register char *p; register int dir; /* 1 for forward, -1 for backward */ { for ( ; ; ) - { while ( isspace(*p) ) p += dir; - if ( !(*p == '/' && p[dir] == '*') ) break; + { while ( is_space(*p) ) + p += dir; + if ( !(*p == '/' && p[dir] == '*') ) + break; p += dir; p += dir; while ( !(*p == '*' && p[dir] == '/') ) - { if ( *p == 0 ) return p; /* multi-line comment?? */ + { if ( *p == 0 ) + return p; /* multi-line comment?? */ p += dir; } p += dir; p += dir; @@ -308,13 +446,16 @@ skipspace(p, dir) /* * Write blanks over part of a string. + * Don't overwrite end-of-line characters. */ int writeblanks(start, end) char *start; char *end; { char *p; - for ( p = start; p < end; p++ ) *p = ' '; + for ( p = start; p < end; p++ ) + if ( *p != '\r' && *p != '\n' ) + *p = ' '; return 0; } @@ -324,8 +465,12 @@ writeblanks(start, end) * Return as follows: * 0 - definitely not a function definition; * 1 - definitely a function definition; + * 2 - definitely a function prototype (NOT USED); * -1 - may be the beginning of a function definition, * append another line and look again. + * The reason we don't attempt to convert function prototypes is that + * Ghostscript's declaration-generating macros look too much like + * prototypes, and confuse the algorithms. */ int test1(buf) @@ -334,24 +479,27 @@ test1(buf) char *bend; char *endfn; int contin; + if ( !isidfirstchar(*p) ) - return 0; /* no name at left margin */ + return 0; /* no name at left margin */ bend = skipspace(buf + strlen(buf) - 1, -1); switch ( *bend ) { - case ')': contin = 1; break; - case '{': - case ';': return 0; /* not a function */ - default: contin = -1; + case ';': contin = 0 /*2*/; break; + case ')': contin = 1; break; + case '{': return 0; /* not a function */ + case '}': return 0; /* not a function */ + default: contin = -1; } - while ( isidchar(*p) ) p++; + while ( isidchar(*p) ) + p++; endfn = p; p = skipspace(p, 1); if ( *p++ != '(' ) - return 0; /* not a function */ + return 0; /* not a function */ p = skipspace(p, 1); if ( *p == ')' ) - return 0; /* no parameters */ + return 0; /* no parameters */ /* Check that the apparent function name isn't a keyword. */ /* We only need to check for keywords that could be followed */ /* by a left parenthesis (which, unfortunately, is most of them). */ @@ -365,19 +513,23 @@ test1(buf) char **key = words; char *kp; int len = endfn - buf; + while ( (kp = *key) != 0 ) { if ( strlen(kp) == len && !strncmp(kp, buf, len) ) - return 0; /* name is a keyword */ + return 0; /* name is a keyword */ key++; } } return contin; } +/* Convert a recognized function definition or header to K&R syntax. */ int -convert1(buf, out) +convert1(buf, out, header, convert_varargs) char *buf; FILE *out; + int header; /* Boolean */ + int convert_varargs; /* Boolean */ { char *endfn; register char *p; char **breaks; @@ -385,9 +537,12 @@ convert1(buf, out) char **btop; char **bp; char **ap; + char *vararg = 0; + /* Pre-ANSI implementations don't agree on whether strchr */ /* is called strchr or index, so we open-code it here. */ - for ( endfn = buf; *(endfn++) != '('; ) ; + for ( endfn = buf; *(endfn++) != '('; ) + ; top: p = endfn; breaks = (char **)malloc(sizeof(char *) * num_breaks * 2); if ( breaks == 0 ) @@ -401,7 +556,10 @@ top: p = endfn; /* Parse the argument list */ do { int level = 0; + char *lp = NULL; + char *rp; char *end = NULL; + if ( bp >= btop ) { /* Filled up break table. */ /* Allocate a bigger one and start over. */ @@ -414,13 +572,27 @@ top: p = endfn; for ( ; end == NULL; p++ ) { switch(*p) { - case ',': if ( !level ) end = p; break; - case '(': level++; break; - case ')': if ( --level < 0 ) end = p; break; - case '/': p = skipspace(p, 1) - 1; break; - default: ; + case ',': + if ( !level ) end = p; + break; + case '(': + if ( !level ) lp = p; + level++; + break; + case ')': + if ( --level < 0 ) end = p; + else rp = p; + break; + case '/': + p = skipspace(p, 1) - 1; + break; + default: + ; } } + /* Erase any embedded prototype parameters. */ + if ( lp ) + writeblanks(lp + 1, rp); p--; /* back up over terminator */ /* Find the name being declared. */ /* This is complicated because of procedure and */ @@ -429,35 +601,42 @@ top: p = endfn; { p = skipspace(p - 1, -1); switch ( *p ) { - case ']': /* skip array dimension(s) */ - case ')': /* skip procedure args OR name */ + case ']': /* skip array dimension(s) */ + case ')': /* skip procedure args OR name */ { int level = 1; while ( level ) switch ( *--p ) { - case ']': case ')': level++; break; - case '[': case '(': level--; break; - case '/': p = skipspace(p, -1) + 1; break; - default: ; + case ']': case ')': level++; break; + case '[': case '(': level--; break; + case '/': p = skipspace(p, -1) + 1; break; + default: ; } } if ( *p == '(' && *skipspace(p + 1, 1) == '*' ) { /* We found the name being declared */ while ( !isidfirstchar(*p) ) - p = skipspace(p, 1) + 1; + p = skipspace(p, 1) + 1; goto found; } break; - default: goto found; + default: + goto found; } } found: if ( *p == '.' && p[-1] == '.' && p[-2] == '.' ) - { p++; - if ( bp == breaks + 1 ) /* sole argument */ - writeblanks(breaks[0], p); + { if ( convert_varargs ) + { *bp++ = "va_alist"; + vararg = p-2; + } else - writeblanks(bp[-1] - 1, p); - bp--; + { p++; + if ( bp == breaks + 1 ) /* sole argument */ + writeblanks(breaks[0], p); + else + writeblanks(bp[-1] - 1, p); + bp--; + } } else { while ( isidchar(*p) ) p--; @@ -478,19 +657,37 @@ found: if ( *p == '.' && p[-1] == '.' && p[-2] == '.' ) } } } - /* Put out the function name */ + /* Put out the function name and left parenthesis. */ p = buf; while ( p != endfn ) putc(*p, out), p++; - /* Put out the declaration */ - for ( ap = breaks+1; ap < bp; ap += 2 ) - { p = *ap; - while ( isidchar(*p) ) putc(*p, out), p++; - if ( ap < bp - 1 ) fputs(", ", out); - } - fputs(") ", out); - /* Put out the argument declarations */ - for ( ap = breaks+2; ap <= bp; ap += 2 ) (*ap)[-1] = ';'; - fputs(breaks[0], out); + /* Put out the declaration. */ + if ( header ) + { fputs(");", out); + for ( p = breaks[0]; *p; p++ ) + if ( *p == '\r' || *p == '\n' ) + putc(*p, out); + } + else + { for ( ap = breaks+1; ap < bp; ap += 2 ) + { p = *ap; + while ( isidchar(*p) ) + putc(*p, out), p++; + if ( ap < bp - 1 ) + fputs(", ", out); + } + fputs(") ", out); + /* Put out the argument declarations */ + for ( ap = breaks+2; ap <= bp; ap += 2 ) + (*ap)[-1] = ';'; + if ( vararg != 0 ) + { *vararg = 0; + fputs(breaks[0], out); /* any prior args */ + fputs("va_dcl", out); /* the final arg */ + fputs(bp[0], out); + } + else + fputs(breaks[0], out); + } free((char *)breaks); return 0; } diff --git a/cdjpeg.c b/cdjpeg.c index 5157cb1..a3d6e06 100644 --- a/cdjpeg.c +++ b/cdjpeg.c @@ -1,7 +1,7 @@ /* * cdjpeg.c * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -31,7 +31,7 @@ static j_common_ptr sig_cinfo; -GLOBAL void /* must be global for Manx C */ +void /* must be global for Manx C */ signal_catcher (int signum) { if (sig_cinfo != NULL) { @@ -43,7 +43,7 @@ signal_catcher (int signum) } -GLOBAL void +GLOBAL(void) enable_signal_catcher (j_common_ptr cinfo) { sig_cinfo = cinfo; @@ -62,7 +62,7 @@ enable_signal_catcher (j_common_ptr cinfo) #ifdef PROGRESS_REPORT -METHODDEF void +METHODDEF(void) progress_monitor (j_common_ptr cinfo) { cd_progress_ptr prog = (cd_progress_ptr) cinfo->progress; @@ -83,7 +83,7 @@ progress_monitor (j_common_ptr cinfo) } -GLOBAL void +GLOBAL(void) start_progress_monitor (j_common_ptr cinfo, cd_progress_ptr progress) { /* Enable progress display, unless trace output is on */ @@ -97,7 +97,7 @@ start_progress_monitor (j_common_ptr cinfo, cd_progress_ptr progress) } -GLOBAL void +GLOBAL(void) end_progress_monitor (j_common_ptr cinfo) { /* Clear away progress display */ @@ -116,7 +116,7 @@ end_progress_monitor (j_common_ptr cinfo) * minchars is length of minimum legal abbreviation. */ -GLOBAL boolean +GLOBAL(boolean) keymatch (char * arg, const char * keyword, int minchars) { register int ca, ck; @@ -143,7 +143,7 @@ keymatch (char * arg, const char * keyword, int minchars) * Non-Unix systems often require some hacking to get out of text mode. */ -GLOBAL FILE * +GLOBAL(FILE *) read_stdin (void) { FILE * input_file = stdin; @@ -161,7 +161,7 @@ read_stdin (void) } -GLOBAL FILE * +GLOBAL(FILE *) write_stdout (void) { FILE * output_file = stdout; diff --git a/cdjpeg.h b/cdjpeg.h index b3ea5d8..cc0d600 100644 --- a/cdjpeg.h +++ b/cdjpeg.h @@ -1,7 +1,7 @@ /* * cdjpeg.h * - * Copyright (C) 1994-1995, Thomas G. Lane. + * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -116,39 +116,39 @@ typedef struct cdjpeg_progress_mgr * cd_progress_ptr; /* Module selection routines for I/O modules. */ -EXTERN cjpeg_source_ptr jinit_read_bmp JPP((j_compress_ptr cinfo)); -EXTERN djpeg_dest_ptr jinit_write_bmp JPP((j_decompress_ptr cinfo, - boolean is_os2)); -EXTERN cjpeg_source_ptr jinit_read_gif JPP((j_compress_ptr cinfo)); -EXTERN djpeg_dest_ptr jinit_write_gif JPP((j_decompress_ptr cinfo)); -EXTERN cjpeg_source_ptr jinit_read_ppm JPP((j_compress_ptr cinfo)); -EXTERN djpeg_dest_ptr jinit_write_ppm JPP((j_decompress_ptr cinfo)); -EXTERN cjpeg_source_ptr jinit_read_rle JPP((j_compress_ptr cinfo)); -EXTERN djpeg_dest_ptr jinit_write_rle JPP((j_decompress_ptr cinfo)); -EXTERN cjpeg_source_ptr jinit_read_targa JPP((j_compress_ptr cinfo)); -EXTERN djpeg_dest_ptr jinit_write_targa JPP((j_decompress_ptr cinfo)); +EXTERN(cjpeg_source_ptr) jinit_read_bmp JPP((j_compress_ptr cinfo)); +EXTERN(djpeg_dest_ptr) jinit_write_bmp JPP((j_decompress_ptr cinfo, + boolean is_os2)); +EXTERN(cjpeg_source_ptr) jinit_read_gif JPP((j_compress_ptr cinfo)); +EXTERN(djpeg_dest_ptr) jinit_write_gif JPP((j_decompress_ptr cinfo)); +EXTERN(cjpeg_source_ptr) jinit_read_ppm JPP((j_compress_ptr cinfo)); +EXTERN(djpeg_dest_ptr) jinit_write_ppm JPP((j_decompress_ptr cinfo)); +EXTERN(cjpeg_source_ptr) jinit_read_rle JPP((j_compress_ptr cinfo)); +EXTERN(djpeg_dest_ptr) jinit_write_rle JPP((j_decompress_ptr cinfo)); +EXTERN(cjpeg_source_ptr) jinit_read_targa JPP((j_compress_ptr cinfo)); +EXTERN(djpeg_dest_ptr) jinit_write_targa JPP((j_decompress_ptr cinfo)); /* cjpeg support routines (in rdswitch.c) */ -EXTERN boolean read_quant_tables JPP((j_compress_ptr cinfo, char * filename, - int scale_factor, boolean force_baseline)); -EXTERN boolean read_scan_script JPP((j_compress_ptr cinfo, char * filename)); -EXTERN boolean set_quant_slots JPP((j_compress_ptr cinfo, char *arg)); -EXTERN boolean set_sample_factors JPP((j_compress_ptr cinfo, char *arg)); +EXTERN(boolean) read_quant_tables JPP((j_compress_ptr cinfo, char * filename, + int scale_factor, boolean force_baseline)); +EXTERN(boolean) read_scan_script JPP((j_compress_ptr cinfo, char * filename)); +EXTERN(boolean) set_quant_slots JPP((j_compress_ptr cinfo, char *arg)); +EXTERN(boolean) set_sample_factors JPP((j_compress_ptr cinfo, char *arg)); /* djpeg support routines (in rdcolmap.c) */ -EXTERN void read_color_map JPP((j_decompress_ptr cinfo, FILE * infile)); +EXTERN(void) read_color_map JPP((j_decompress_ptr cinfo, FILE * infile)); /* common support routines (in cdjpeg.c) */ -EXTERN void enable_signal_catcher JPP((j_common_ptr cinfo)); -EXTERN void start_progress_monitor JPP((j_common_ptr cinfo, - cd_progress_ptr progress)); -EXTERN void end_progress_monitor JPP((j_common_ptr cinfo)); -EXTERN boolean keymatch JPP((char * arg, const char * keyword, int minchars)); -EXTERN FILE * read_stdin JPP((void)); -EXTERN FILE * write_stdout JPP((void)); +EXTERN(void) enable_signal_catcher JPP((j_common_ptr cinfo)); +EXTERN(void) start_progress_monitor JPP((j_common_ptr cinfo, + cd_progress_ptr progress)); +EXTERN(void) end_progress_monitor JPP((j_common_ptr cinfo)); +EXTERN(boolean) keymatch JPP((char * arg, const char * keyword, int minchars)); +EXTERN(FILE *) read_stdin JPP((void)); +EXTERN(FILE *) write_stdout JPP((void)); /* miscellaneous useful macros */ diff --git a/change.log b/change.log index d76da4b..231650e 100644 --- a/change.log +++ b/change.log @@ -1,6 +1,46 @@ CHANGE LOG for Independent JPEG Group's JPEG software +Version 6a 7-Feb-96 +-------------------- + +Library initialization sequence modified to detect version mismatches +and struct field packing mismatches between library and calling application. +This change requires applications to be recompiled, but does not require +any application source code change. + +All routine declarations changed to the style "GLOBAL(type) name ...", +that is, GLOBAL, LOCAL, METHODDEF, EXTERN are now macros taking the +routine's return type as an argument. This makes it possible to add +Microsoft-style linkage keywords to all the routines by changing just +these macros. Note that any application code that was using these macros +will have to be changed. + +DCT coefficient quantization tables are now stored in normal array order +rather than zigzag order. Application code that calls jpeg_add_quant_table, +or otherwise manipulates quantization tables directly, will need to be +changed. If you need to make such code work with either older or newer +versions of the library, a test like "#if JPEG_LIB_VERSION >= 61" is +recommended. + +djpeg's trace capability now dumps DQT tables in natural order, not zigzag +order. This allows the trace output to be made into a "-qtables" file +more easily. + +New system-dependent memory manager module for use on Apple Macintosh. + +Fix bug in cjpeg's -smooth option: last one or two scanlines would be +duplicates of the prior line unless the image height mod 16 was 1 or 2. + +Repair minor problems in VMS, BCC, MC6 makefiles. + +New configure script based on latest GNU Autoconf. + +Correct the list of include files needed by MetroWerks C for ccommand(). + +Numerous small documentation updates. + + Version 6 2-Aug-95 ------------------- diff --git a/cjpeg.c b/cjpeg.c index 3fbb276..194d93b 100644 --- a/cjpeg.c +++ b/cjpeg.c @@ -1,7 +1,7 @@ /* * cjpeg.c * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -28,7 +28,8 @@ #ifdef USE_CCOMMAND /* command-line reader for Macintosh */ #ifdef __MWERKS__ -#include /* Metrowerks declares it here */ +#include /* Metrowerks needs this */ +#include /* ... and this */ #endif #ifdef THINK_C #include /* Think declares it here */ @@ -75,7 +76,7 @@ static const char * const cdjpeg_message_table[] = { static boolean is_targa; /* records user -targa switch */ -LOCAL cjpeg_source_ptr +LOCAL(cjpeg_source_ptr) select_file_type (j_compress_ptr cinfo, FILE * infile) { int c; @@ -136,7 +137,7 @@ static const char * progname; /* program name for error messages */ static char * outfilename; /* for -outfile switch */ -LOCAL void +LOCAL(void) usage (void) /* complain about bad command line */ { @@ -194,7 +195,7 @@ usage (void) } -LOCAL int +LOCAL(int) parse_switches (j_compress_ptr cinfo, int argc, char **argv, int last_file_arg_seen, boolean for_real) /* Parse optional switches. @@ -456,7 +457,7 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, * The main program. */ -GLOBAL int +int main (int argc, char **argv) { struct jpeg_compress_struct cinfo; diff --git a/coderules.doc b/coderules.doc index b28034e..0ab5d9b 100644 --- a/coderules.doc +++ b/coderules.doc @@ -1,6 +1,6 @@ IJG JPEG LIBRARY: CODING RULES -Copyright (C) 1991-1994, Thomas G. Lane. +Copyright (C) 1991-1996, Thomas G. Lane. This file is part of the Independent JPEG Group's software. For conditions of distribution and use, see the accompanying README file. @@ -43,17 +43,17 @@ ansi2knr is not very bright, so it imposes a format requirement on function declarations: the function name MUST BEGIN IN COLUMN 1. Thus all functions should be written in the following style: -LOCAL int * +LOCAL(int *) function_name (int a, char *b) { code... } -Note that each function definition is prefixed with GLOBAL, LOCAL, or -METHODDEF. These macros expand to "static" or nothing as appropriate. -They provide a readable indication of the routine's usage and can readily be -changed for special needs. (For instance, all routines can be made global for -use with debuggers or code profilers that require it.) +Note that each function definition must begin with GLOBAL(type), LOCAL(type), +or METHODDEF(type). These macros expand to "static type" or just "type" as +appropriate. They provide a readable indication of the routine's usage and +can readily be changed for special needs. (For instance, special linkage +keywords can be inserted for use in Windows DLLs.) ansi2knr does not transform method declarations (function pointers in structs). We handle these with a macro JMETHOD, defined as @@ -69,8 +69,8 @@ which is used like this: }; Note the set of parentheses surrounding the parameter list. -A similar solution is used for external function declarations (see the JPP -macro). +A similar solution is used for forward and external function declarations +(see the EXTERN and JPP macros). If the code is to work on non-ANSI compilers, we cannot rely on a prototype declaration to coerce actual parameters into the right types. Therefore, use diff --git a/configure b/configure index db861ff..146c43a 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.4 +# Generated automatically using autoconf version 2.7 # Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -37,9 +37,22 @@ target=NONE verbose= x_includes=NONE x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' # Initialize some other variables. subdirs= +MFLAGS= MAKEFLAGS= ac_prev= for ac_option @@ -61,9 +74,14 @@ do case "$ac_option" in - -build | --build | --buil | --bui | --bu | --b) + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) ac_prev=build ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*) + -build=* | --build=* | --buil=* | --bui=* | --bu=*) build="$ac_optarg" ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ @@ -73,6 +91,12 @@ do | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file="$ac_optarg" ;; + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + -disable-* | --disable-*) ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` # Reject names that are not valid shell variable names. @@ -123,12 +147,29 @@ Configuration: Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] - --exec-prefix=PREFIX install architecture-dependent files in PREFIX + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] --srcdir=DIR find the sources in DIR [configure dir or ..] --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM run sed PROGRAM on installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF Host type: --build=BUILD configure for building on BUILD [BUILD=HOST] --host=HOST configure for HOST [guessed] @@ -140,8 +181,10 @@ Features and packages: --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR ---enable and --with options recognized:$ac_help EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi exit 0 ;; -host | --host | --hos | --ho) @@ -149,6 +192,44 @@ EOF -host=* | --host=* | --hos=* | --ho=*) host="$ac_optarg" ;; + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; @@ -161,6 +242,15 @@ EOF | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) @@ -201,6 +291,23 @@ EOF | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) @@ -211,6 +318,13 @@ EOF -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir="$ac_optarg" ;; + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) @@ -220,7 +334,7 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.4" + echo "configure generated by autoconf version 2.7" exit 0 ;; -with-* | --with-*) @@ -277,7 +391,7 @@ EOF eval "$varname='$val'" eval "export $varname" ;; - *) + *) if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then echo "configure: warning: $ac_option: invalid host type" 1>&2 fi @@ -389,9 +503,12 @@ done ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5 2>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5 2>&5' +ac_cpp='echo $CPP $CPPFLAGS 1>&5; +$CPP $CPPFLAGS' +ac_compile='echo ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5; +${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5 2>&5' +ac_link='echo ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5; +${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5 2>&5' if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. @@ -494,7 +611,7 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error @@ -508,7 +625,7 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error @@ -542,7 +659,7 @@ else ac_cv_c_cross=yes else cat > conftest.$ac_ext <&6 +cross_compiling=$ac_cv_c_cross echo $ac_n "checking for function prototypes""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ijg_cv_have_prototypes'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext < EOF @@ -643,7 +761,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -675,7 +793,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -704,7 +822,7 @@ fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext < EOF @@ -766,7 +884,7 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then EOF cat > conftest.$ac_ext < EOF @@ -793,7 +911,7 @@ fi fi echo $ac_n "checking for type unsigned char""... $ac_c" 1>&6 cat > conftest.$ac_ext <&6 cat > conftest.$ac_ext <&6 cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext <&6 if test $ac_cv_c_const = no; then cat >> confdefs.h <<\EOF @@ -954,7 +1073,7 @@ fi echo $ac_n "checking for inline""... $ac_c" 1>&6 ijg_cv_inline="" cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <> confdefs.h <&6 cat > conftest.$ac_ext <&6 cat > conftest.$ac_ext < conftest.$ac_ext <&6 else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext < @@ -1263,15 +1382,15 @@ fi MEMORYMGR="jmemnobs.o" MAXMEM="no" # Check whether --enable-maxmem or --disable-maxmem was given. -enableval="$enable_maxmem" -if test -n "$enableval"; then +if test "${enable_maxmem+set}" = set; then + enableval="$enable_maxmem" MAXMEM="$enableval" fi # support --with-maxmem for backwards compatibility with IJG V5. # Check whether --with-maxmem or --without-maxmem was given. -withval="$with_maxmem" -if test -n "$withval"; then +if test "${with_maxmem+set}" = set; then + withval="$with_maxmem" MAXMEM="$withval" fi @@ -1289,7 +1408,7 @@ EOF echo $ac_n "checking for 'tmpfile()'""... $ac_c" 1>&6 cat > conftest.$ac_ext < int main() { return 0; } @@ -1310,7 +1429,7 @@ cat >> confdefs.h <<\EOF EOF echo $ac_n "checking for 'mktemp()'""... $ac_c" 1>&6 cat > conftest.$ac_ext <> $CONFIG_STATUS < conftest.subs <<\CEOF +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF $ac_vpsub $extrasub s%@CFLAGS@%$CFLAGS%g @@ -1426,6 +1547,18 @@ s%@LIBS@%$LIBS%g s%@exec_prefix@%$exec_prefix%g s%@prefix@%$prefix%g s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g s%@CC@%$CC%g s%@CPP@%$CPP%g s%@INSTALL@%$INSTALL%g @@ -1530,7 +1663,7 @@ EOF # Transform confdefs.h into a sed script conftest.vals that substitutes # the proper values into config.h.in to produce config.h. And first: -# Protect against being on the right side of a sed subst in config.status. +# Protect against being on the right side of a sed subst in config.status. # Protect against being in an unquoted here document in config.status. rm -f conftest.vals cat > conftest.hdr <<\EOF diff --git a/djpeg.c b/djpeg.c index 5685cdc..5465994 100644 --- a/djpeg.c +++ b/djpeg.c @@ -1,7 +1,7 @@ /* * djpeg.c * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -30,7 +30,8 @@ #ifdef USE_CCOMMAND /* command-line reader for Macintosh */ #ifdef __MWERKS__ -#include /* Metrowerks declares it here */ +#include /* Metrowerks needs this */ +#include /* ... and this */ #endif #ifdef THINK_C #include /* Think declares it here */ @@ -85,7 +86,7 @@ static const char * progname; /* program name for error messages */ static char * outfilename; /* for -outfile switch */ -LOCAL void +LOCAL(void) usage (void) /* complain about bad command line */ { @@ -157,7 +158,7 @@ usage (void) } -LOCAL int +LOCAL(int) parse_switches (j_decompress_ptr cinfo, int argc, char **argv, int last_file_arg_seen, boolean for_real) /* Parse optional switches. @@ -349,7 +350,7 @@ parse_switches (j_decompress_ptr cinfo, int argc, char **argv, * Note this code relies on a non-suspending data source. */ -LOCAL unsigned int +LOCAL(unsigned int) jpeg_getc (j_decompress_ptr cinfo) /* Read next byte */ { @@ -364,7 +365,7 @@ jpeg_getc (j_decompress_ptr cinfo) } -METHODDEF boolean +METHODDEF(boolean) COM_handler (j_decompress_ptr cinfo) { boolean traceit = (cinfo->err->trace_level >= 1); @@ -414,7 +415,7 @@ COM_handler (j_decompress_ptr cinfo) * The main program. */ -GLOBAL int +int main (int argc, char **argv) { struct jpeg_decompress_struct cinfo; diff --git a/example.c b/example.c index 4fce47d..7fc354f 100644 --- a/example.c +++ b/example.c @@ -68,7 +68,7 @@ extern int image_width; /* Number of columns in image */ * and a compression quality factor are passed in. */ -GLOBAL void +GLOBAL(void) write_JPEG_file (char * filename, int quality) { /* This struct contains the JPEG compression parameters and pointers to @@ -259,7 +259,7 @@ typedef struct my_error_mgr * my_error_ptr; * Here's the routine that will replace the standard error_exit method: */ -METHODDEF void +METHODDEF(void) my_error_exit (j_common_ptr cinfo) { /* cinfo->err really points to a my_error_mgr struct, so coerce pointer */ @@ -280,7 +280,7 @@ my_error_exit (j_common_ptr cinfo) */ -GLOBAL int +GLOBAL(int) read_JPEG_file (char * filename) { /* This struct contains the JPEG decompression parameters and pointers to diff --git a/filelist.doc b/filelist.doc index 3a6ab43..707dc1c 100644 --- a/filelist.doc +++ b/filelist.doc @@ -1,6 +1,6 @@ IJG JPEG LIBRARY: FILE LIST -Copyright (C) 1994-1995, Thomas G. Lane. +Copyright (C) 1994-1996, Thomas G. Lane. This file is part of the Independent JPEG Group's software. For conditions of distribution and use, see the accompanying README file. @@ -115,6 +115,7 @@ jmemansi.c Makes temporary files with ANSI-standard routine tmpfile(). jmemname.c Makes temporary files with program-generated file names. jmemdos.c Custom implementation for MS-DOS: knows about extended and expanded memory as well as temporary files. +jmemmac.c Custom implementation for Apple Macintosh. Exactly one of the system-dependent modules should be configured into an installed JPEG library (see install.doc for hints about which one to use). diff --git a/install.doc b/install.doc index 1260f7a..585b29b 100644 --- a/install.doc +++ b/install.doc @@ -1,6 +1,6 @@ INSTALLATION INSTRUCTIONS for the Independent JPEG Group's JPEG software -Copyright (C) 1991-1995, Thomas G. Lane. +Copyright (C) 1991-1996, Thomas G. Lane. This file is part of the Independent JPEG Group's software. For conditions of distribution and use, see the accompanying README file. @@ -216,7 +216,7 @@ Selecting a memory manager The IJG code is capable of working on images that are too big to fit in main memory; data is swapped out to temporary files as necessary. However, the -code to do this is rather system-dependent. We provide four different +code to do this is rather system-dependent. We provide five different memory managers: * jmemansi.c This version uses the ANSI-standard library routine tmpfile(), @@ -240,7 +240,10 @@ memory managers: IMPORTANT: if you use this, define USE_MSDOS_MEMMGR in jconfig.h, and include the assembly file jmemdosa.asm in the programs. The supplied makefiles and jconfig files for - MS-DOS compilers already do both. + 16-bit MS-DOS compilers already do both. + +* jmemmac.c Custom version for Apple Macintosh; see the system-specific + notes for Macintosh for more info. To use a particular memory manager, change the SYSDEPMEM variable in your makefile to equal the corresponding object file name (for example, jmemansi.o @@ -253,8 +256,8 @@ If yours doesn't, try jmemansi.c first. If that doesn't compile, you'll have to use jmemname.c; be sure to adjust select_file_name() for local conditions. You may also need to change unlink() to remove() in close_backing_store(). -Except with jmemnobs.c, you need to adjust the DEFAULT_MAX_MEM setting to a -reasonable value for your system (either by adding a #define for +Except with jmemnobs.c or jmemmac.c, you need to adjust the DEFAULT_MAX_MEM +setting to a reasonable value for your system (either by adding a #define for DEFAULT_MAX_MEM to jconfig.h, or by adding a -D switch to the Makefile). This value limits the amount of data space the program will attempt to allocate. Code and static data space isn't counted, so the actual memory @@ -627,6 +630,25 @@ to A.08.07. If you get complaints about "not a typedef name", you'll have to use makefile.unix, or run configure without the CC option. +Macintosh, generic comments: + +The supplied user-interface files (cjpeg.c, djpeg.c, etc) are set up to +provide a Unix-style command line interface. You can use this interface on +the Mac by means of the ccommand() library routine provided by Metrowerks +CodeWarrior or Think C. This is only appropriate for testing the library, +however; to make a user-friendly equivalent of cjpeg/djpeg you'd really want +to develop a Mac-style user interface. Such an interface exists for pre-v5 +IJG libraries (see the Think C entry, below) but at this writing it has not +been updated to work with the current release. + +We recommend replacing "malloc" and "free" by "NewPtr" and "DisposePtr" in +whichever memory manager back end you use, because Mac C libraries often +have inferior implementations of malloc/free. jmemmac.c is recommended; +it is a customized version of jmemansi.c with this change and a Mac-specific +implementation of jpeg_mem_available(). You can also use jmemnobs.c if you +don't care about handling images larger than available memory. + + Macintosh, MPW: We don't directly support MPW in the current release, but Larry Rosenstein @@ -640,8 +662,10 @@ Macintosh, Metrowerks CodeWarrior: Metrowerks release DR2 has problems with the IJG code; don't use it. Release DR3.5 or later should be OK. -The command-line-style interface can be used by defining USE_CCOMMAND and -TWO_FILE_COMMANDLINE (see next entry for more details). +The Unix-command-line-style interface can be used by defining USE_CCOMMAND. +You'll also need to define either TWO_FILE_COMMANDLINE (to avoid stdin/stdout) +or USE_FDOPEN (to make stdin/stdout work in binary mode). See the Think C +entry for more details. On 680x0 Macs, Metrowerks defines type "double" as a 10-byte IEEE extended float. jmemmgr.c won't like this: it wants sizeof(ALIGN_TYPE) to be a power @@ -650,15 +674,12 @@ of 2. Add "#define ALIGN_TYPE long" to jconfig.h to eliminate the complaint. Macintosh, Think C: -The supplied user-interface files (cjpeg.c and djpeg.c) are set up to provide -a Unix-style command line interface. You can use this interface on the Mac -by means of Think's ccommand() library routine. However, a much better -Mac-style user interface has been prepared by Jim Brunner. You can obtain -the additional source code needed for that user interface by FTP to -sumex-aim.stanford.edu, file /info-mac/dev/src/jpeg-convert-c.hqx. Jim's -documentation also includes more detailed build instructions for Think C. -(Jim is working on updating this code to work with v5 of the IJG library, -but it wasn't ready as of v5 release time. Should be out before too long.) +Jim Brunner has prepared a Mac-style user interface for the IJG library. +Unfortunately, the released version of it only works with pre-v5 libraries; +still, it may be a useful starting point. You can obtain Jim's additional +source code from the Info-Mac archives, at sumex-aim.stanford.edu or mirrors +thereof; see file /info-mac/dev/src/jpeg-convert-c.hqx. Jim's documentation +also includes more detailed build instructions for Think C. If you want to build the minimal command line version, proceed as follows. You'll have to prepare project files for the programs; we don't include any @@ -770,6 +791,14 @@ go32.exe to do "make standalone". MS-DOS, Microsoft C: +makefile.mc6 works with Microsoft C, Visual C++, etc. Note that this +makefile assumes that the working copy of itself is called "makefile". +If you want to call it something else, say "makefile.mak", be sure to adjust +the dependency line that reads "$(RFILE) : makefile". Otherwise the make +will fail because it doesn't know how to create "makefile". Worse, some +releases of Microsoft's make utilities give an incorrect error message in +this situation. + If you want one-file command line style, just undefine TWO_FILE_COMMANDLINE. jconfig.mc6 already includes #define USE_SETMODE to make this work. (fdopen does not work correctly.) @@ -801,6 +830,28 @@ making that part of jmorecfg.h read like this: #ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ typedef unsigned char boolean; #endif +In v6a and later, using incompatible definitions of boolean will usually lead +to the failure message "JPEG parameter struct mismatch", rather than the +difficult-to-diagnose bugs it caused with earlier versions. + +When using the library in a Windows application, you will almost certainly +want to modify or replace the error handler module jerror.c, since our +default error handler does a couple of inappropriate things: + 1. it tries to write error and warning messages on stderr; + 2. in event of a fatal error, it exits by calling exit(). +A simple stopgap solution for problem 1 is to replace the line + fprintf(stderr, "%s\n", buffer); +(in output_message in jerror.c) with something like + MessageBox(GetActiveWindow(),buffer,"JPEG Error",MB_OK); +It's highly recommended that you at least do that much, since otherwise +error messages will disappear into nowhere. +The proper solution for problem 2 is to return control to your calling +application after a library error. This can be done with the setjmp/longjmp +technique discussed in libjpeg.doc and illustrated in example.c. + +You may also want to modify jdatasrc.c and jdatadst.c to use Windows file +operations rather than fread/fwrite. This is only necessary if your C +compiler doesn't provide a competent implementation of C stdio functions. Many people want to convert the IJG library into a DLL. This is reasonably straightforward, but watch out for the following: @@ -813,6 +864,20 @@ that isn't true in a medium-model DLL. jdatadst.c don't work if you open a file in your application and then pass the pointer to the DLL. One workaround is to make jdatasrc.c/jdatadst.c part of your main application rather than part of the DLL. + 3. You'll probably need to modify the macros GLOBAL() and EXTERN() to +attach suitable linkage keywords to the exported routine names. Similarly, +you'll want to modify METHODDEF() and JMETHOD() to ensure function pointers +are declared in a way that lets application routines be called back through +the function pointers. These macros are in jmorecfg.h. Typical definitions +for a 16-bit DLL are: + #define GLOBAL(type) type _far _pascal _loadds _export + #define EXTERN(type) extern type _far _pascal + #define METHODDEF(type) static type _far _pascal + #define JMETHOD(type,methodname,arglist) \ + type (_far _pascal *methodname) arglist +Although not all the GLOBAL routines are actually intended to be called by +the application, the performance cost of making them all DLL entry points is +negligible. The unmodified IJG library presents a very C-specific application interface, so the resulting DLL is only usable from C or C++ applications. There has @@ -824,22 +889,27 @@ but hasn't been very high priority --- any volunteers out there? Microsoft Windows, Borland C: Borland C++ 4.5 fails with an internal compiler error when trying to compile -jdmerge.c. If enough people complain, perhaps Borland will fix it. -In the meantime, you can work around the problem by undefining -UPSAMPLE_MERGING_SUPPORTED in jmorecfg.h, at the price of losing most of the -speedup from the "-nosmooth" decompression option. Alternatively, I'm told -that replacing three or more uses of h2v1_merged_upsample()'s variable -"range_limit" with direct references to "cinfo->sample_range_limit" makes -the problem go away, though the routine is then a little slower than it -should be. Pretty bizarre, especially since the very similar routine -h2v2_merged_upsample doesn't trigger the bug. +jdmerge.c in 32-bit mode. If enough people complain, perhaps Borland will fix +it. In the meantime, the simplest known workaround is to add a redundant +definition of the variable range_limit in h2v1_merged_upsample(), at the head +of the block that handles odd image width (about line 268 in v6 jdmerge.c): + /* If image width is odd, do the last output column separately */ + if (cinfo->output_width & 1) { + register JSAMPLE * range_limit = cinfo->sample_range_limit; /* ADD THIS */ + cb = GETJSAMPLE(*inptr1); +Pretty bizarre, especially since the very similar routine h2v2_merged_upsample +doesn't trigger the bug. +Recent reports suggest that this bug does not occur with "bcc32a" (the +Pentium-optimized version of the compiler). SGI: -Set "AR2= ar -ts" rather than "AR2= ranlib" in the Makefile. If you are -using configure, you should say +On some SGI systems, you may need to set "AR2= ar -ts" in the Makefile. +If you are using configure, you can do this by saying ./configure RANLIB='ar -ts' +This change is not needed on all SGIs. Use it only if the make fails at the +stage of linking the completed programs. On the MIPS R4000 architecture (Indy, etc.), the compiler option "-mips2" reportedly speeds up the float DCT method substantially, enough to make it diff --git a/jcapimin.c b/jcapimin.c index 1cd9736..6d86457 100644 --- a/jcapimin.c +++ b/jcapimin.c @@ -1,7 +1,7 @@ /* * jcapimin.c * - * Copyright (C) 1994-1995, Thomas G. Lane. + * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -26,11 +26,19 @@ * The error manager must already be set up (in case memory manager fails). */ -GLOBAL void -jpeg_create_compress (j_compress_ptr cinfo) +GLOBAL(void) +jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize) { int i; + /* Guard against version mismatches between library and caller. */ + cinfo->mem = NULL; /* so jpeg_destroy knows mem mgr not called */ + if (version != JPEG_LIB_VERSION) + ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version); + if (structsize != SIZEOF(struct jpeg_compress_struct)) + ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE, + (int) SIZEOF(struct jpeg_compress_struct), (int) structsize); + /* For debugging purposes, zero the whole master structure. * But error manager pointer is already there, so save and restore it. */ @@ -69,7 +77,7 @@ jpeg_create_compress (j_compress_ptr cinfo) * Destruction of a JPEG compression object */ -GLOBAL void +GLOBAL(void) jpeg_destroy_compress (j_compress_ptr cinfo) { jpeg_destroy((j_common_ptr) cinfo); /* use common routine */ @@ -81,7 +89,7 @@ jpeg_destroy_compress (j_compress_ptr cinfo) * but don't destroy the object itself. */ -GLOBAL void +GLOBAL(void) jpeg_abort_compress (j_compress_ptr cinfo) { jpeg_abort((j_common_ptr) cinfo); /* use common routine */ @@ -100,7 +108,7 @@ jpeg_abort_compress (j_compress_ptr cinfo) * jcparam.o would be linked whether the application used it or not. */ -GLOBAL void +GLOBAL(void) jpeg_suppress_tables (j_compress_ptr cinfo, boolean suppress) { int i; @@ -128,7 +136,7 @@ jpeg_suppress_tables (j_compress_ptr cinfo, boolean suppress) * work including most of the actual output. */ -GLOBAL void +GLOBAL(void) jpeg_finish_compress (j_compress_ptr cinfo) { JDIMENSION iMCU_row; @@ -173,7 +181,7 @@ jpeg_finish_compress (j_compress_ptr cinfo) * first call to jpeg_write_scanlines() or jpeg_write_raw_data(). */ -GLOBAL void +GLOBAL(void) jpeg_write_marker (j_compress_ptr cinfo, int marker, const JOCTET *dataptr, unsigned int datalen) { @@ -208,7 +216,7 @@ jpeg_write_marker (j_compress_ptr cinfo, int marker, * will not re-emit the tables unless it is passed write_all_tables=TRUE. */ -GLOBAL void +GLOBAL(void) jpeg_write_tables (j_compress_ptr cinfo) { if (cinfo->global_state != CSTATE_START) diff --git a/jcapistd.c b/jcapistd.c index b99e560..c0320b1 100644 --- a/jcapistd.c +++ b/jcapistd.c @@ -1,7 +1,7 @@ /* * jcapistd.c * - * Copyright (C) 1994-1995, Thomas G. Lane. + * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -34,7 +34,7 @@ * wrong thing. */ -GLOBAL void +GLOBAL(void) jpeg_start_compress (j_compress_ptr cinfo, boolean write_all_tables) { if (cinfo->global_state != CSTATE_START) @@ -73,7 +73,7 @@ jpeg_start_compress (j_compress_ptr cinfo, boolean write_all_tables) * when using a multiple-scanline buffer. */ -GLOBAL JDIMENSION +GLOBAL(JDIMENSION) jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION num_lines) { @@ -116,7 +116,7 @@ jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines, * Processes exactly one iMCU row per call, unless suspended. */ -GLOBAL JDIMENSION +GLOBAL(JDIMENSION) jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data, JDIMENSION num_lines) { diff --git a/jccoefct.c b/jccoefct.c index ea3169b..d971ce5 100644 --- a/jccoefct.c +++ b/jccoefct.c @@ -1,7 +1,7 @@ /* * jccoefct.c * - * Copyright (C) 1994-1995, Thomas G. Lane. + * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -58,17 +58,17 @@ typedef my_coef_controller * my_coef_ptr; /* Forward declarations */ -METHODDEF boolean compress_data +METHODDEF(boolean) compress_data JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf)); #ifdef FULL_COEF_BUFFER_SUPPORTED -METHODDEF boolean compress_first_pass +METHODDEF(boolean) compress_first_pass JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf)); -METHODDEF boolean compress_output +METHODDEF(boolean) compress_output JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf)); #endif -LOCAL void +LOCAL(void) start_iMCU_row (j_compress_ptr cinfo) /* Reset within-iMCU-row counters for a new row */ { @@ -96,7 +96,7 @@ start_iMCU_row (j_compress_ptr cinfo) * Initialize for a processing pass. */ -METHODDEF void +METHODDEF(void) start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode) { my_coef_ptr coef = (my_coef_ptr) cinfo->coef; @@ -139,7 +139,7 @@ start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode) * For single pass, this is the same as the components in the scan. */ -METHODDEF boolean +METHODDEF(boolean) compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf) { my_coef_ptr coef = (my_coef_ptr) cinfo->coef; @@ -240,7 +240,7 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf) * at the scan-dependent variables (MCU dimensions, etc). */ -METHODDEF boolean +METHODDEF(boolean) compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf) { my_coef_ptr coef = (my_coef_ptr) cinfo->coef; @@ -336,7 +336,7 @@ compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf) * NB: input_buf is ignored; it is likely to be a NULL pointer. */ -METHODDEF boolean +METHODDEF(boolean) compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf) { my_coef_ptr coef = (my_coef_ptr) cinfo->coef; @@ -400,7 +400,7 @@ compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf) * Initialize coefficient buffer controller. */ -GLOBAL void +GLOBAL(void) jinit_c_coef_controller (j_compress_ptr cinfo, boolean need_full_buffer) { my_coef_ptr coef; diff --git a/jccolor.c b/jccolor.c index 6707911..0a8a4b5 100644 --- a/jccolor.c +++ b/jccolor.c @@ -1,7 +1,7 @@ /* * jccolor.c * - * Copyright (C) 1991-1994, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -82,7 +82,7 @@ typedef my_color_converter * my_cconvert_ptr; * Initialize for RGB->YCC colorspace conversion. */ -METHODDEF void +METHODDEF(void) rgb_ycc_start (j_compress_ptr cinfo) { my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; @@ -126,7 +126,7 @@ rgb_ycc_start (j_compress_ptr cinfo) * offset required on that side. */ -METHODDEF void +METHODDEF(void) rgb_ycc_convert (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows) @@ -182,7 +182,7 @@ rgb_ycc_convert (j_compress_ptr cinfo, * We assume rgb_ycc_start has been called (we only use the Y tables). */ -METHODDEF void +METHODDEF(void) rgb_gray_convert (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows) @@ -221,7 +221,7 @@ rgb_gray_convert (j_compress_ptr cinfo, * We assume rgb_ycc_start has been called. */ -METHODDEF void +METHODDEF(void) cmyk_ycck_convert (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows) @@ -276,7 +276,7 @@ cmyk_ycck_convert (j_compress_ptr cinfo, * The source can be either plain grayscale or YCbCr (since Y == gray). */ -METHODDEF void +METHODDEF(void) grayscale_convert (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows) @@ -305,7 +305,7 @@ grayscale_convert (j_compress_ptr cinfo, * We assume input_components == num_components. */ -METHODDEF void +METHODDEF(void) null_convert (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows) @@ -337,7 +337,7 @@ null_convert (j_compress_ptr cinfo, * Empty method for start_pass. */ -METHODDEF void +METHODDEF(void) null_method (j_compress_ptr cinfo) { /* no work needed */ @@ -348,7 +348,7 @@ null_method (j_compress_ptr cinfo) * Module initialization routine for input colorspace conversion. */ -GLOBAL void +GLOBAL(void) jinit_color_converter (j_compress_ptr cinfo) { my_cconvert_ptr cconvert; diff --git a/jcdctmgr.c b/jcdctmgr.c index 588b844..61fa79b 100644 --- a/jcdctmgr.c +++ b/jcdctmgr.c @@ -1,7 +1,7 @@ /* * jcdctmgr.c * - * Copyright (C) 1994-1995, Thomas G. Lane. + * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -27,8 +27,7 @@ typedef struct { /* The actual post-DCT divisors --- not identical to the quant table * entries, because of scaling (especially for an unnormalized DCT). - * Each table is given in normal array order; note that this must - * be converted from the zigzag order of the quantization tables. + * Each table is given in normal array order. */ DCTELEM * divisors[NUM_QUANT_TBLS]; @@ -51,7 +50,7 @@ typedef my_fdct_controller * my_fdct_ptr; * first scan. Hence all components should be examined here. */ -METHODDEF void +METHODDEF(void) start_pass_fdctmgr (j_compress_ptr cinfo) { my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct; @@ -83,7 +82,7 @@ start_pass_fdctmgr (j_compress_ptr cinfo) } dtbl = fdct->divisors[qtblno]; for (i = 0; i < DCTSIZE2; i++) { - dtbl[i] = ((DCTELEM) qtbl->quantval[jpeg_zigzag_order[i]]) << 3; + dtbl[i] = ((DCTELEM) qtbl->quantval[i]) << 3; } break; #endif @@ -98,7 +97,7 @@ start_pass_fdctmgr (j_compress_ptr cinfo) */ #define CONST_BITS 14 static const INT16 aanscales[DCTSIZE2] = { - /* precomputed values scaled up by 14 bits: in natural order */ + /* precomputed values scaled up by 14 bits */ 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, 22725, 31521, 29692, 26722, 22725, 17855, 12299, 6270, 21407, 29692, 27969, 25172, 21407, 16819, 11585, 5906, @@ -118,7 +117,7 @@ start_pass_fdctmgr (j_compress_ptr cinfo) dtbl = fdct->divisors[qtblno]; for (i = 0; i < DCTSIZE2; i++) { dtbl[i] = (DCTELEM) - DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[jpeg_zigzag_order[i]], + DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i], (INT32) aanscales[i]), CONST_BITS-3); } @@ -153,7 +152,7 @@ start_pass_fdctmgr (j_compress_ptr cinfo) for (row = 0; row < DCTSIZE; row++) { for (col = 0; col < DCTSIZE; col++) { fdtbl[i] = (FAST_FLOAT) - (1.0 / (((double) qtbl->quantval[jpeg_zigzag_order[i]] * + (1.0 / (((double) qtbl->quantval[i] * aanscalefactor[row] * aanscalefactor[col] * 8.0))); i++; } @@ -177,7 +176,7 @@ start_pass_fdctmgr (j_compress_ptr cinfo) * blocks. The quantized coefficients are returned in coef_blocks[]. */ -METHODDEF void +METHODDEF(void) forward_DCT (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY sample_data, JBLOCKROW coef_blocks, JDIMENSION start_row, JDIMENSION start_col, @@ -267,7 +266,7 @@ forward_DCT (j_compress_ptr cinfo, jpeg_component_info * compptr, #ifdef DCT_FLOAT_SUPPORTED -METHODDEF void +METHODDEF(void) forward_DCT_float (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY sample_data, JBLOCKROW coef_blocks, JDIMENSION start_row, JDIMENSION start_col, @@ -342,7 +341,7 @@ forward_DCT_float (j_compress_ptr cinfo, jpeg_component_info * compptr, * Initialize FDCT manager. */ -GLOBAL void +GLOBAL(void) jinit_forward_dct (j_compress_ptr cinfo) { my_fdct_ptr fdct; diff --git a/jchuff.c b/jchuff.c index 59f7865..b3eec8a 100644 --- a/jchuff.c +++ b/jchuff.c @@ -1,7 +1,7 @@ /* * jchuff.c * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -86,13 +86,13 @@ typedef struct { /* Forward declarations */ -METHODDEF boolean encode_mcu_huff JPP((j_compress_ptr cinfo, - JBLOCKROW *MCU_data)); -METHODDEF void finish_pass_huff JPP((j_compress_ptr cinfo)); +METHODDEF(boolean) encode_mcu_huff JPP((j_compress_ptr cinfo, + JBLOCKROW *MCU_data)); +METHODDEF(void) finish_pass_huff JPP((j_compress_ptr cinfo)); #ifdef ENTROPY_OPT_SUPPORTED -METHODDEF boolean encode_mcu_gather JPP((j_compress_ptr cinfo, - JBLOCKROW *MCU_data)); -METHODDEF void finish_pass_gather JPP((j_compress_ptr cinfo)); +METHODDEF(boolean) encode_mcu_gather JPP((j_compress_ptr cinfo, + JBLOCKROW *MCU_data)); +METHODDEF(void) finish_pass_gather JPP((j_compress_ptr cinfo)); #endif @@ -102,7 +102,7 @@ METHODDEF void finish_pass_gather JPP((j_compress_ptr cinfo)); * just count the Huffman symbols used and generate Huffman code tables. */ -METHODDEF void +METHODDEF(void) start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics) { huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; @@ -175,7 +175,7 @@ start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics) * Note this is also used by jcphuff.c. */ -GLOBAL void +GLOBAL(void) jpeg_make_c_derived_tbl (j_compress_ptr cinfo, JHUFF_TBL * htbl, c_derived_tbl ** pdtbl) { @@ -243,7 +243,7 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, JHUFF_TBL * htbl, { action; } } -LOCAL boolean +LOCAL(boolean) dump_buffer (working_state * state) /* Empty the output buffer; return TRUE if successful, FALSE if must suspend */ { @@ -267,7 +267,7 @@ dump_buffer (working_state * state) */ INLINE -LOCAL boolean +LOCAL(boolean) emit_bits (working_state * state, unsigned int code, int size) /* Emit some bits; return TRUE if successful, FALSE if must suspend */ { @@ -305,7 +305,7 @@ emit_bits (working_state * state, unsigned int code, int size) } -LOCAL boolean +LOCAL(boolean) flush_bits (working_state * state) { if (! emit_bits(state, 0x7F, 7)) /* fill any partial byte with ones */ @@ -318,7 +318,7 @@ flush_bits (working_state * state) /* Encode a single block's worth of coefficients */ -LOCAL boolean +LOCAL(boolean) encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val, c_derived_tbl *dctbl, c_derived_tbl *actbl) { @@ -408,7 +408,7 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val, * Emit a restart marker & resynchronize predictions. */ -LOCAL boolean +LOCAL(boolean) emit_restart (working_state * state, int restart_num) { int ci; @@ -433,7 +433,7 @@ emit_restart (working_state * state, int restart_num) * Encode and output one MCU's worth of Huffman-compressed coefficients. */ -METHODDEF boolean +METHODDEF(boolean) encode_mcu_huff (j_compress_ptr cinfo, JBLOCKROW *MCU_data) { huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; @@ -490,7 +490,7 @@ encode_mcu_huff (j_compress_ptr cinfo, JBLOCKROW *MCU_data) * Finish up at the end of a Huffman-compressed scan. */ -METHODDEF void +METHODDEF(void) finish_pass_huff (j_compress_ptr cinfo) { huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; @@ -536,7 +536,7 @@ finish_pass_huff (j_compress_ptr cinfo) /* Process a single block's worth of coefficients */ -LOCAL void +LOCAL(void) htest_one_block (JCOEFPTR block, int last_dc_val, long dc_counts[], long ac_counts[]) { @@ -601,7 +601,7 @@ htest_one_block (JCOEFPTR block, int last_dc_val, * No data is actually output, so no suspension return is possible. */ -METHODDEF boolean +METHODDEF(boolean) encode_mcu_gather (j_compress_ptr cinfo, JBLOCKROW *MCU_data) { huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; @@ -638,7 +638,7 @@ encode_mcu_gather (j_compress_ptr cinfo, JBLOCKROW *MCU_data) * Note this is also used by jcphuff.c. */ -GLOBAL void +GLOBAL(void) jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]) { #define MAX_CLEN 32 /* assumed maximum initial code length */ @@ -779,7 +779,7 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]) * Finish up a statistics-gathering pass and create the new Huffman tables. */ -METHODDEF void +METHODDEF(void) finish_pass_gather (j_compress_ptr cinfo) { huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; @@ -824,7 +824,7 @@ finish_pass_gather (j_compress_ptr cinfo) * Module initialization routine for Huffman entropy encoding. */ -GLOBAL void +GLOBAL(void) jinit_huff_encoder (j_compress_ptr cinfo) { huff_entropy_ptr entropy; diff --git a/jchuff.h b/jchuff.h index f43d571..fa4643a 100644 --- a/jchuff.h +++ b/jchuff.h @@ -1,7 +1,7 @@ /* * jchuff.h * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -26,9 +26,9 @@ typedef struct { #endif /* NEED_SHORT_EXTERNAL_NAMES */ /* Expand a Huffman table definition into the derived format */ -EXTERN void jpeg_make_c_derived_tbl JPP((j_compress_ptr cinfo, - JHUFF_TBL * htbl, c_derived_tbl ** pdtbl)); +EXTERN(void) jpeg_make_c_derived_tbl + JPP((j_compress_ptr cinfo, JHUFF_TBL * htbl, c_derived_tbl ** pdtbl)); /* Generate an optimal table definition given the specified counts */ -EXTERN void jpeg_gen_optimal_table JPP((j_compress_ptr cinfo, - JHUFF_TBL * htbl, long freq[])); +EXTERN(void) jpeg_gen_optimal_table + JPP((j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])); diff --git a/jcinit.c b/jcinit.c index 2cc82b2..d96bb37 100644 --- a/jcinit.c +++ b/jcinit.c @@ -1,7 +1,7 @@ /* * jcinit.c * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -26,7 +26,7 @@ * which modules will be used and give them appropriate initialization calls. */ -GLOBAL void +GLOBAL(void) jinit_compress_master (j_compress_ptr cinfo) { /* Initialize master control (includes parameter checking/processing) */ diff --git a/jcmainct.c b/jcmainct.c index 65b113f..e0279a7 100644 --- a/jcmainct.c +++ b/jcmainct.c @@ -1,7 +1,7 @@ /* * jcmainct.c * - * Copyright (C) 1994-1995, Thomas G. Lane. + * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -51,11 +51,11 @@ typedef my_main_controller * my_main_ptr; /* Forward declarations */ -METHODDEF void process_data_simple_main +METHODDEF(void) process_data_simple_main JPP((j_compress_ptr cinfo, JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail)); #ifdef FULL_MAIN_BUFFER_SUPPORTED -METHODDEF void process_data_buffer_main +METHODDEF(void) process_data_buffer_main JPP((j_compress_ptr cinfo, JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail)); #endif @@ -65,7 +65,7 @@ METHODDEF void process_data_buffer_main * Initialize for a processing pass. */ -METHODDEF void +METHODDEF(void) start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode) { my_main_ptr main = (my_main_ptr) cinfo->main; @@ -109,7 +109,7 @@ start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode) * where we have only a strip buffer. */ -METHODDEF void +METHODDEF(void) process_data_simple_main (j_compress_ptr cinfo, JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail) @@ -165,7 +165,7 @@ process_data_simple_main (j_compress_ptr cinfo, * This routine handles all of the modes that use a full-size buffer. */ -METHODDEF void +METHODDEF(void) process_data_buffer_main (j_compress_ptr cinfo, JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail) @@ -241,7 +241,7 @@ process_data_buffer_main (j_compress_ptr cinfo, * Initialize main buffer controller. */ -GLOBAL void +GLOBAL(void) jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer) { my_main_ptr main; diff --git a/jcmarker.c b/jcmarker.c index f4d290b..0198954 100644 --- a/jcmarker.c +++ b/jcmarker.c @@ -1,7 +1,7 @@ /* * jcmarker.c * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -93,7 +93,7 @@ typedef enum { /* JPEG marker codes */ * points where markers will be written. */ -LOCAL void +LOCAL(void) emit_byte (j_compress_ptr cinfo, int val) /* Emit a byte */ { @@ -107,7 +107,7 @@ emit_byte (j_compress_ptr cinfo, int val) } -LOCAL void +LOCAL(void) emit_marker (j_compress_ptr cinfo, JPEG_MARKER mark) /* Emit a marker code */ { @@ -116,7 +116,7 @@ emit_marker (j_compress_ptr cinfo, JPEG_MARKER mark) } -LOCAL void +LOCAL(void) emit_2bytes (j_compress_ptr cinfo, int value) /* Emit a 2-byte integer; these are always MSB first in JPEG files */ { @@ -129,7 +129,7 @@ emit_2bytes (j_compress_ptr cinfo, int value) * Routines to write specific marker types. */ -LOCAL int +LOCAL(int) emit_dqt (j_compress_ptr cinfo, int index) /* Emit a DQT marker */ /* Returns the precision used (0 = 8bits, 1 = 16bits) for baseline checking */ @@ -155,9 +155,11 @@ emit_dqt (j_compress_ptr cinfo, int index) emit_byte(cinfo, index + (prec<<4)); for (i = 0; i < DCTSIZE2; i++) { + /* The table entries must be emitted in zigzag order. */ + unsigned int qval = qtbl->quantval[jpeg_natural_order[i]]; if (prec) - emit_byte(cinfo, qtbl->quantval[i] >> 8); - emit_byte(cinfo, qtbl->quantval[i] & 0xFF); + emit_byte(cinfo, qval >> 8); + emit_byte(cinfo, qval & 0xFF); } qtbl->sent_table = TRUE; @@ -167,7 +169,7 @@ emit_dqt (j_compress_ptr cinfo, int index) } -LOCAL void +LOCAL(void) emit_dht (j_compress_ptr cinfo, int index, boolean is_ac) /* Emit a DHT marker */ { @@ -205,7 +207,7 @@ emit_dht (j_compress_ptr cinfo, int index, boolean is_ac) } -LOCAL void +LOCAL(void) emit_dac (j_compress_ptr cinfo) /* Emit a DAC marker */ /* Since the useful info is so small, we want to emit all the tables in */ @@ -248,7 +250,7 @@ emit_dac (j_compress_ptr cinfo) } -LOCAL void +LOCAL(void) emit_dri (j_compress_ptr cinfo) /* Emit a DRI marker */ { @@ -260,7 +262,7 @@ emit_dri (j_compress_ptr cinfo) } -LOCAL void +LOCAL(void) emit_sof (j_compress_ptr cinfo, JPEG_MARKER code) /* Emit a SOF marker */ { @@ -291,7 +293,7 @@ emit_sof (j_compress_ptr cinfo, JPEG_MARKER code) } -LOCAL void +LOCAL(void) emit_sos (j_compress_ptr cinfo) /* Emit a SOS marker */ { @@ -332,7 +334,7 @@ emit_sos (j_compress_ptr cinfo) } -LOCAL void +LOCAL(void) emit_jfif_app0 (j_compress_ptr cinfo) /* Emit a JFIF-compliant APP0 marker */ { @@ -370,7 +372,7 @@ emit_jfif_app0 (j_compress_ptr cinfo) } -LOCAL void +LOCAL(void) emit_adobe_app14 (j_compress_ptr cinfo) /* Emit an Adobe APP14 marker */ { @@ -424,7 +426,7 @@ emit_adobe_app14 (j_compress_ptr cinfo) * Other uses are not guaranteed to produce desirable results. */ -METHODDEF void +METHODDEF(void) write_any_marker (j_compress_ptr cinfo, int marker, const JOCTET *dataptr, unsigned int datalen) /* Emit an arbitrary marker with parameters */ @@ -453,7 +455,7 @@ write_any_marker (j_compress_ptr cinfo, int marker, * jpeg_start_compress returns. */ -METHODDEF void +METHODDEF(void) write_file_header (j_compress_ptr cinfo) { emit_marker(cinfo, M_SOI); /* first the SOI */ @@ -473,7 +475,7 @@ write_file_header (j_compress_ptr cinfo) * try to error-check the quant table numbers as soon as they see the SOF. */ -METHODDEF void +METHODDEF(void) write_frame_header (j_compress_ptr cinfo) { int ci, prec; @@ -530,7 +532,7 @@ write_frame_header (j_compress_ptr cinfo) * Compressed data will be written following the SOS. */ -METHODDEF void +METHODDEF(void) write_scan_header (j_compress_ptr cinfo) { int i; @@ -579,7 +581,7 @@ write_scan_header (j_compress_ptr cinfo) * Write datastream trailer. */ -METHODDEF void +METHODDEF(void) write_file_trailer (j_compress_ptr cinfo) { emit_marker(cinfo, M_EOI); @@ -593,7 +595,7 @@ write_file_trailer (j_compress_ptr cinfo) * emitted. Note that all tables will be marked sent_table = TRUE at exit. */ -METHODDEF void +METHODDEF(void) write_tables_only (j_compress_ptr cinfo) { int i; @@ -622,7 +624,7 @@ write_tables_only (j_compress_ptr cinfo) * Initialize the marker writer module. */ -GLOBAL void +GLOBAL(void) jinit_marker_writer (j_compress_ptr cinfo) { /* Create the subobject */ diff --git a/jcmaster.c b/jcmaster.c index 84494e6..c3e1ef5 100644 --- a/jcmaster.c +++ b/jcmaster.c @@ -1,7 +1,7 @@ /* * jcmaster.c * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -42,7 +42,7 @@ typedef my_comp_master * my_master_ptr; * Support routines that do various essential calculations. */ -LOCAL void +LOCAL(void) initial_setup (j_compress_ptr cinfo) /* Do computations that are needed before master selection phase */ { @@ -126,7 +126,7 @@ initial_setup (j_compress_ptr cinfo) #ifdef C_MULTISCAN_FILES_SUPPORTED -LOCAL void +LOCAL(void) validate_script (j_compress_ptr cinfo) /* Verify that the scan script in cinfo->scan_info[] is valid; also * determine whether it uses progressive JPEG, and set cinfo->progressive_mode. @@ -251,7 +251,7 @@ validate_script (j_compress_ptr cinfo) #endif /* C_MULTISCAN_FILES_SUPPORTED */ -LOCAL void +LOCAL(void) select_scan_parameters (j_compress_ptr cinfo) /* Set up the scan parameters for the current scan */ { @@ -292,7 +292,7 @@ select_scan_parameters (j_compress_ptr cinfo) } -LOCAL void +LOCAL(void) per_scan_setup (j_compress_ptr cinfo) /* Do computations that are needed before processing a JPEG scan */ /* cinfo->comps_in_scan and cinfo->cur_comp_info[] are already set */ @@ -385,7 +385,7 @@ per_scan_setup (j_compress_ptr cinfo) * required. */ -METHODDEF void +METHODDEF(void) prepare_for_pass (j_compress_ptr cinfo) { my_master_ptr master = (my_master_ptr) cinfo->master; @@ -473,7 +473,7 @@ prepare_for_pass (j_compress_ptr cinfo) * In multi-pass processing, this routine is not used. */ -METHODDEF void +METHODDEF(void) pass_startup (j_compress_ptr cinfo) { cinfo->master->call_pass_startup = FALSE; /* reset flag so call only once */ @@ -487,7 +487,7 @@ pass_startup (j_compress_ptr cinfo) * Finish up at end of pass. */ -METHODDEF void +METHODDEF(void) finish_pass_master (j_compress_ptr cinfo) { my_master_ptr master = (my_master_ptr) cinfo->master; @@ -527,7 +527,7 @@ finish_pass_master (j_compress_ptr cinfo) * Initialize master compression control. */ -GLOBAL void +GLOBAL(void) jinit_c_master_control (j_compress_ptr cinfo, boolean transcode_only) { my_master_ptr master; diff --git a/jcomapi.c b/jcomapi.c index c10903f..b518ec6 100644 --- a/jcomapi.c +++ b/jcomapi.c @@ -1,7 +1,7 @@ /* * jcomapi.c * - * Copyright (C) 1994, Thomas G. Lane. + * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -25,7 +25,7 @@ * responsibility. */ -GLOBAL void +GLOBAL(void) jpeg_abort (j_common_ptr cinfo) { int pool; @@ -53,7 +53,7 @@ jpeg_abort (j_common_ptr cinfo) * responsibility. */ -GLOBAL void +GLOBAL(void) jpeg_destroy (j_common_ptr cinfo) { /* We need only tell the memory manager to release everything. */ @@ -70,7 +70,7 @@ jpeg_destroy (j_common_ptr cinfo) * (Would jutils.c be a more reasonable place to put these?) */ -GLOBAL JQUANT_TBL * +GLOBAL(JQUANT_TBL *) jpeg_alloc_quant_table (j_common_ptr cinfo) { JQUANT_TBL *tbl; @@ -82,7 +82,7 @@ jpeg_alloc_quant_table (j_common_ptr cinfo) } -GLOBAL JHUFF_TBL * +GLOBAL(JHUFF_TBL *) jpeg_alloc_huff_table (j_common_ptr cinfo) { JHUFF_TBL *tbl; diff --git a/jcparam.c b/jcparam.c index 29862d3..54871d5 100644 --- a/jcparam.c +++ b/jcparam.c @@ -1,7 +1,7 @@ /* * jcparam.c * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -19,7 +19,7 @@ * Quantization table setup routines */ -GLOBAL void +GLOBAL(void) jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl, const unsigned int *basic_table, int scale_factor, boolean force_baseline) @@ -55,7 +55,7 @@ jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl, } -GLOBAL void +GLOBAL(void) jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor, boolean force_baseline) /* Set or change the 'quality' (quantization) setting, using default tables @@ -64,31 +64,30 @@ jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor, * applications that insist on a linear percentage scaling. */ { - /* This is the sample quantization table given in the JPEG spec section K.1, - * but expressed in zigzag order (as are all of our quant. tables). + /* These are the sample quantization tables given in JPEG spec section K.1. * The spec says that the values given produce "good" quality, and * when divided by 2, "very good" quality. */ static const unsigned int std_luminance_quant_tbl[DCTSIZE2] = { - 16, 11, 12, 14, 12, 10, 16, 14, - 13, 14, 18, 17, 16, 19, 24, 40, - 26, 24, 22, 22, 24, 49, 35, 37, - 29, 40, 58, 51, 61, 60, 57, 51, - 56, 55, 64, 72, 92, 78, 64, 68, - 87, 69, 55, 56, 80, 109, 81, 87, - 95, 98, 103, 104, 103, 62, 77, 113, - 121, 112, 100, 120, 92, 101, 103, 99 - }; + 16, 11, 10, 16, 24, 40, 51, 61, + 12, 12, 14, 19, 26, 58, 60, 55, + 14, 13, 16, 24, 40, 57, 69, 56, + 14, 17, 22, 29, 51, 87, 80, 62, + 18, 22, 37, 56, 68, 109, 103, 77, + 24, 35, 55, 64, 81, 104, 113, 92, + 49, 64, 78, 87, 103, 121, 120, 101, + 72, 92, 95, 98, 112, 100, 103, 99 + }; static const unsigned int std_chrominance_quant_tbl[DCTSIZE2] = { - 17, 18, 18, 24, 21, 24, 47, 26, - 26, 47, 99, 66, 56, 66, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, + 17, 18, 24, 47, 99, 99, 99, 99, + 18, 21, 26, 66, 99, 99, 99, 99, + 24, 26, 56, 99, 99, 99, 99, 99, + 47, 66, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 - }; + }; /* Set up two quantization tables using the specified scaling */ jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl, @@ -98,7 +97,7 @@ jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor, } -GLOBAL int +GLOBAL(int) jpeg_quality_scaling (int quality) /* Convert a user-specified quality rating to a percentage scaling factor * for an underlying quantization table, using our recommended scaling curve. @@ -111,8 +110,8 @@ jpeg_quality_scaling (int quality) /* The basic table is used as-is (scaling 100) for a quality of 50. * Qualities 50..100 are converted to scaling percentage 200 - 2*Q; - * note that at Q=100 the scaling is 0, which will cause j_add_quant_table - * to make all the table entries 1 (hence, no quantization loss). + * note that at Q=100 the scaling is 0, which will cause jpeg_add_quant_table + * to make all the table entries 1 (hence, minimum quantization loss). * Qualities 1..50 are converted to scaling percentage 5000/Q. */ if (quality < 50) @@ -124,7 +123,7 @@ jpeg_quality_scaling (int quality) } -GLOBAL void +GLOBAL(void) jpeg_set_quality (j_compress_ptr cinfo, int quality, boolean force_baseline) /* Set or change the 'quality' (quantization) setting, using default tables. * This is the standard quality-adjusting entry point for typical user @@ -144,7 +143,7 @@ jpeg_set_quality (j_compress_ptr cinfo, int quality, boolean force_baseline) * Huffman table setup routines */ -LOCAL void +LOCAL(void) add_huff_table (j_compress_ptr cinfo, JHUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val) /* Define a Huffman table */ @@ -160,7 +159,7 @@ add_huff_table (j_compress_ptr cinfo, } -LOCAL void +LOCAL(void) std_huff_tables (j_compress_ptr cinfo) /* Set up the standard Huffman tables (cf. JPEG standard section K.3) */ /* IMPORTANT: these are only valid for 8-bit data precision! */ @@ -246,7 +245,7 @@ std_huff_tables (j_compress_ptr cinfo) * your code will still work (they'll be set to reasonable defaults). */ -GLOBAL void +GLOBAL(void) jpeg_set_defaults (j_compress_ptr cinfo) { int i; @@ -329,7 +328,7 @@ jpeg_set_defaults (j_compress_ptr cinfo) * Select an appropriate JPEG colorspace for in_color_space. */ -GLOBAL void +GLOBAL(void) jpeg_default_colorspace (j_compress_ptr cinfo) { switch (cinfo->in_color_space) { @@ -361,7 +360,7 @@ jpeg_default_colorspace (j_compress_ptr cinfo) * Set the JPEG colorspace, and choose colorspace-dependent default values. */ -GLOBAL void +GLOBAL(void) jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace) { jpeg_component_info * compptr; @@ -445,7 +444,7 @@ jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace) #ifdef C_PROGRESSIVE_SUPPORTED -LOCAL jpeg_scan_info * +LOCAL(jpeg_scan_info *) fill_a_scan (jpeg_scan_info * scanptr, int ci, int Ss, int Se, int Ah, int Al) /* Support routine: generate one scan for specified component */ @@ -460,7 +459,7 @@ fill_a_scan (jpeg_scan_info * scanptr, int ci, return scanptr; } -LOCAL jpeg_scan_info * +LOCAL(jpeg_scan_info *) fill_scans (jpeg_scan_info * scanptr, int ncomps, int Ss, int Se, int Ah, int Al) /* Support routine: generate one scan for each component */ @@ -479,7 +478,7 @@ fill_scans (jpeg_scan_info * scanptr, int ncomps, return scanptr; } -LOCAL jpeg_scan_info * +LOCAL(jpeg_scan_info *) fill_dc_scans (jpeg_scan_info * scanptr, int ncomps, int Ah, int Al) /* Support routine: generate interleaved DC scan if possible, else N scans */ { @@ -507,7 +506,7 @@ fill_dc_scans (jpeg_scan_info * scanptr, int ncomps, int Ah, int Al) * cinfo->num_components and cinfo->jpeg_color_space must be correct. */ -GLOBAL void +GLOBAL(void) jpeg_simple_progression (j_compress_ptr cinfo) { int ncomps = cinfo->num_components; diff --git a/jcphuff.c b/jcphuff.c index 922c17c..9ace161 100644 --- a/jcphuff.c +++ b/jcphuff.c @@ -1,7 +1,7 @@ /* * jcphuff.c * - * Copyright (C) 1995, Thomas G. Lane. + * Copyright (C) 1995-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -86,23 +86,23 @@ typedef phuff_entropy_encoder * phuff_entropy_ptr; #endif /* Forward declarations */ -METHODDEF boolean encode_mcu_DC_first JPP((j_compress_ptr cinfo, - JBLOCKROW *MCU_data)); -METHODDEF boolean encode_mcu_AC_first JPP((j_compress_ptr cinfo, - JBLOCKROW *MCU_data)); -METHODDEF boolean encode_mcu_DC_refine JPP((j_compress_ptr cinfo, +METHODDEF(boolean) encode_mcu_DC_first JPP((j_compress_ptr cinfo, JBLOCKROW *MCU_data)); -METHODDEF boolean encode_mcu_AC_refine JPP((j_compress_ptr cinfo, +METHODDEF(boolean) encode_mcu_AC_first JPP((j_compress_ptr cinfo, JBLOCKROW *MCU_data)); -METHODDEF void finish_pass_phuff JPP((j_compress_ptr cinfo)); -METHODDEF void finish_pass_gather_phuff JPP((j_compress_ptr cinfo)); +METHODDEF(boolean) encode_mcu_DC_refine JPP((j_compress_ptr cinfo, + JBLOCKROW *MCU_data)); +METHODDEF(boolean) encode_mcu_AC_refine JPP((j_compress_ptr cinfo, + JBLOCKROW *MCU_data)); +METHODDEF(void) finish_pass_phuff JPP((j_compress_ptr cinfo)); +METHODDEF(void) finish_pass_gather_phuff JPP((j_compress_ptr cinfo)); /* * Initialize for a Huffman-compressed scan using progressive JPEG. */ -METHODDEF void +METHODDEF(void) start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics) { phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; @@ -208,7 +208,7 @@ start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics) dump_buffer(entropy); } -LOCAL void +LOCAL(void) dump_buffer (phuff_entropy_ptr entropy) /* Empty the output buffer; we do not support suspension in this module. */ { @@ -231,7 +231,7 @@ dump_buffer (phuff_entropy_ptr entropy) */ INLINE -LOCAL void +LOCAL(void) emit_bits (phuff_entropy_ptr entropy, unsigned int code, int size) /* Emit some bits, unless we are in gather mode */ { @@ -270,7 +270,7 @@ emit_bits (phuff_entropy_ptr entropy, unsigned int code, int size) } -LOCAL void +LOCAL(void) flush_bits (phuff_entropy_ptr entropy) { emit_bits(entropy, 0x7F, 7); /* fill any partial byte with ones */ @@ -284,7 +284,7 @@ flush_bits (phuff_entropy_ptr entropy) */ INLINE -LOCAL void +LOCAL(void) emit_symbol (phuff_entropy_ptr entropy, int tbl_no, int symbol) { if (entropy->gather_statistics) @@ -300,7 +300,7 @@ emit_symbol (phuff_entropy_ptr entropy, int tbl_no, int symbol) * Emit bits from a correction bit buffer. */ -LOCAL void +LOCAL(void) emit_buffered_bits (phuff_entropy_ptr entropy, char * bufstart, unsigned int nbits) { @@ -319,7 +319,7 @@ emit_buffered_bits (phuff_entropy_ptr entropy, char * bufstart, * Emit any pending EOBRUN symbol. */ -LOCAL void +LOCAL(void) emit_eobrun (phuff_entropy_ptr entropy) { register int temp, nbits; @@ -347,7 +347,7 @@ emit_eobrun (phuff_entropy_ptr entropy) * Emit a restart marker & resynchronize predictions. */ -LOCAL void +LOCAL(void) emit_restart (phuff_entropy_ptr entropy, int restart_num) { int ci; @@ -377,7 +377,7 @@ emit_restart (phuff_entropy_ptr entropy, int restart_num) * or first pass of successive approximation). */ -METHODDEF boolean +METHODDEF(boolean) encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) { phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; @@ -459,7 +459,7 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) * or first pass of successive approximation). */ -METHODDEF boolean +METHODDEF(boolean) encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) { phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; @@ -563,7 +563,7 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) * is not very clear on the point. */ -METHODDEF boolean +METHODDEF(boolean) encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) { phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; @@ -610,7 +610,7 @@ encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) * MCU encoding for AC successive approximation refinement scan. */ -METHODDEF boolean +METHODDEF(boolean) encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) { phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; @@ -738,7 +738,7 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) * Finish up at the end of a Huffman-compressed progressive scan. */ -METHODDEF void +METHODDEF(void) finish_pass_phuff (j_compress_ptr cinfo) { phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; @@ -759,7 +759,7 @@ finish_pass_phuff (j_compress_ptr cinfo) * Finish up a statistics-gathering pass and create the new Huffman tables. */ -METHODDEF void +METHODDEF(void) finish_pass_gather_phuff (j_compress_ptr cinfo) { phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; @@ -806,7 +806,7 @@ finish_pass_gather_phuff (j_compress_ptr cinfo) * Module initialization routine for progressive Huffman entropy encoding. */ -GLOBAL void +GLOBAL(void) jinit_phuff_encoder (j_compress_ptr cinfo) { phuff_entropy_ptr entropy; diff --git a/jcprepct.c b/jcprepct.c index 7e60946..fa93333 100644 --- a/jcprepct.c +++ b/jcprepct.c @@ -1,7 +1,7 @@ /* * jcprepct.c * - * Copyright (C) 1994, Thomas G. Lane. + * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -74,7 +74,7 @@ typedef my_prep_controller * my_prep_ptr; * Initialize for a processing pass. */ -METHODDEF void +METHODDEF(void) start_pass_prep (j_compress_ptr cinfo, J_BUF_MODE pass_mode) { my_prep_ptr prep = (my_prep_ptr) cinfo->prep; @@ -102,7 +102,7 @@ start_pass_prep (j_compress_ptr cinfo, J_BUF_MODE pass_mode) * by duplicating the bottom row. */ -LOCAL void +LOCAL(void) expand_bottom_edge (JSAMPARRAY image_data, JDIMENSION num_cols, int input_rows, int output_rows) { @@ -124,7 +124,7 @@ expand_bottom_edge (JSAMPARRAY image_data, JDIMENSION num_cols, * input rows. */ -METHODDEF void +METHODDEF(void) pre_process_data (j_compress_ptr cinfo, JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail, @@ -191,7 +191,7 @@ pre_process_data (j_compress_ptr cinfo, * Process some data in the context case. */ -METHODDEF void +METHODDEF(void) pre_process_context (j_compress_ptr cinfo, JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail, @@ -202,7 +202,6 @@ pre_process_context (j_compress_ptr cinfo, int numrows, ci; int buf_height = cinfo->max_v_samp_factor * 3; JDIMENSION inrows; - jpeg_component_info * compptr; while (*out_row_group_ctr < out_row_groups_avail) { if (*in_row_ctr < in_rows_avail) { @@ -232,15 +231,14 @@ pre_process_context (j_compress_ptr cinfo, /* Return for more data, unless we are at the bottom of the image. */ if (prep->rows_to_go != 0) break; - } - /* If at bottom of image, pad to fill the conversion buffer. */ - if (prep->rows_to_go == 0 && - prep->next_buf_row < prep->next_buf_stop) { - for (ci = 0; ci < cinfo->num_components; ci++) { - expand_bottom_edge(prep->color_buf[ci], cinfo->image_width, - prep->next_buf_row, prep->next_buf_stop); + /* When at bottom of image, pad to fill the conversion buffer. */ + if (prep->next_buf_row < prep->next_buf_stop) { + for (ci = 0; ci < cinfo->num_components; ci++) { + expand_bottom_edge(prep->color_buf[ci], cinfo->image_width, + prep->next_buf_row, prep->next_buf_stop); + } + prep->next_buf_row = prep->next_buf_stop; } - prep->next_buf_row = prep->next_buf_stop; } /* If we've gotten enough data, downsample a row group. */ if (prep->next_buf_row == prep->next_buf_stop) { @@ -257,21 +255,6 @@ pre_process_context (j_compress_ptr cinfo, prep->next_buf_row = 0; prep->next_buf_stop = prep->next_buf_row + cinfo->max_v_samp_factor; } - /* If at bottom of image, pad the output to a full iMCU height. - * Note we assume the caller is providing a one-iMCU-height output buffer! - */ - if (prep->rows_to_go == 0 && - *out_row_group_ctr < out_row_groups_avail) { - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - expand_bottom_edge(output_buf[ci], - compptr->width_in_blocks * DCTSIZE, - (int) (*out_row_group_ctr * compptr->v_samp_factor), - (int) (out_row_groups_avail * compptr->v_samp_factor)); - } - *out_row_group_ctr = out_row_groups_avail; - break; /* can exit outer loop without test */ - } } } @@ -280,7 +263,7 @@ pre_process_context (j_compress_ptr cinfo, * Create the wrapped-around downsampling input buffer needed for context mode. */ -LOCAL void +LOCAL(void) create_context_buffer (j_compress_ptr cinfo) { my_prep_ptr prep = (my_prep_ptr) cinfo->prep; @@ -328,7 +311,7 @@ create_context_buffer (j_compress_ptr cinfo) * Initialize preprocessing controller. */ -GLOBAL void +GLOBAL(void) jinit_c_prep_controller (j_compress_ptr cinfo, boolean need_full_buffer) { my_prep_ptr prep; diff --git a/jcsample.c b/jcsample.c index bf0fb46..212ec87 100644 --- a/jcsample.c +++ b/jcsample.c @@ -1,7 +1,7 @@ /* * jcsample.c * - * Copyright (C) 1991-1994, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -71,7 +71,7 @@ typedef my_downsampler * my_downsample_ptr; * Initialize for a downsampling pass. */ -METHODDEF void +METHODDEF(void) start_pass_downsample (j_compress_ptr cinfo) { /* no work for now */ @@ -83,7 +83,7 @@ start_pass_downsample (j_compress_ptr cinfo) * by duplicating the rightmost samples. */ -LOCAL void +LOCAL(void) expand_right_edge (JSAMPARRAY image_data, int num_rows, JDIMENSION input_cols, JDIMENSION output_cols) { @@ -110,7 +110,7 @@ expand_right_edge (JSAMPARRAY image_data, int num_rows, * In this version we simply downsample each component independently. */ -METHODDEF void +METHODDEF(void) sep_downsample (j_compress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_index, JSAMPIMAGE output_buf, JDIMENSION out_row_group_index) @@ -136,7 +136,7 @@ sep_downsample (j_compress_ptr cinfo, * Note that this version is not actually used for customary sampling ratios. */ -METHODDEF void +METHODDEF(void) int_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY output_data) { @@ -183,7 +183,7 @@ int_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, * without smoothing. */ -METHODDEF void +METHODDEF(void) fullsize_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY output_data) { @@ -208,7 +208,7 @@ fullsize_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, * alternate pixel locations (a simple ordered dither pattern). */ -METHODDEF void +METHODDEF(void) h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY output_data) { @@ -245,7 +245,7 @@ h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, * without smoothing. */ -METHODDEF void +METHODDEF(void) h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY output_data) { @@ -288,7 +288,7 @@ h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, * with smoothing. One row of context is required. */ -METHODDEF void +METHODDEF(void) h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY output_data) { @@ -388,7 +388,7 @@ h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, * with smoothing. One row of context is required. */ -METHODDEF void +METHODDEF(void) fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data) { @@ -460,7 +460,7 @@ fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr, * Note that we must select a routine for each component. */ -GLOBAL void +GLOBAL(void) jinit_downsampler (j_compress_ptr cinfo) { my_downsample_ptr downsample; diff --git a/jctrans.c b/jctrans.c index 8fc53b1..4296048 100644 --- a/jctrans.c +++ b/jctrans.c @@ -1,7 +1,7 @@ /* * jctrans.c * - * Copyright (C) 1995, Thomas G. Lane. + * Copyright (C) 1995-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -16,9 +16,9 @@ /* Forward declarations */ -LOCAL void transencode_master_selection +LOCAL(void) transencode_master_selection JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays)); -LOCAL void transencode_coef_controller +LOCAL(void) transencode_coef_controller JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays)); @@ -34,7 +34,7 @@ LOCAL void transencode_coef_controller * typically will be realized during this routine and filled afterwards. */ -GLOBAL void +GLOBAL(void) jpeg_write_coefficients (j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays) { if (cinfo->global_state != CSTATE_START) @@ -59,7 +59,7 @@ jpeg_write_coefficients (j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays) * scan script and Huffman optimization) are left in their default states. */ -GLOBAL void +GLOBAL(void) jpeg_copy_critical_parameters (j_decompress_ptr srcinfo, j_compress_ptr dstinfo) { @@ -137,7 +137,7 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo, * This substitutes for jcinit.c's initialization of the full compressor. */ -LOCAL void +LOCAL(void) transencode_master_selection (j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays) { @@ -206,7 +206,7 @@ typedef struct { typedef my_coef_controller * my_coef_ptr; -LOCAL void +LOCAL(void) start_iMCU_row (j_compress_ptr cinfo) /* Reset within-iMCU-row counters for a new row */ { @@ -234,7 +234,7 @@ start_iMCU_row (j_compress_ptr cinfo) * Initialize for a processing pass. */ -METHODDEF void +METHODDEF(void) start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode) { my_coef_ptr coef = (my_coef_ptr) cinfo->coef; @@ -257,7 +257,7 @@ start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode) * NB: input_buf is ignored; it is likely to be a NULL pointer. */ -METHODDEF boolean +METHODDEF(boolean) compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf) { my_coef_ptr coef = (my_coef_ptr) cinfo->coef; @@ -342,7 +342,7 @@ compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf) * with unitheight at least v_samp_factor. */ -LOCAL void +LOCAL(void) transencode_coef_controller (j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays) { diff --git a/jdapimin.c b/jdapimin.c index d568187..c702154 100644 --- a/jdapimin.c +++ b/jdapimin.c @@ -1,7 +1,7 @@ /* * jdapimin.c * - * Copyright (C) 1994-1995, Thomas G. Lane. + * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -26,11 +26,19 @@ * The error manager must already be set up (in case memory manager fails). */ -GLOBAL void -jpeg_create_decompress (j_decompress_ptr cinfo) +GLOBAL(void) +jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, size_t structsize) { int i; + /* Guard against version mismatches between library and caller. */ + cinfo->mem = NULL; /* so jpeg_destroy knows mem mgr not called */ + if (version != JPEG_LIB_VERSION) + ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version); + if (structsize != SIZEOF(struct jpeg_decompress_struct)) + ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE, + (int) SIZEOF(struct jpeg_decompress_struct), (int) structsize); + /* For debugging purposes, zero the whole master structure. * But error manager pointer is already there, so save and restore it. */ @@ -73,7 +81,7 @@ jpeg_create_decompress (j_decompress_ptr cinfo) * Destruction of a JPEG decompression object */ -GLOBAL void +GLOBAL(void) jpeg_destroy_decompress (j_decompress_ptr cinfo) { jpeg_destroy((j_common_ptr) cinfo); /* use common routine */ @@ -85,7 +93,7 @@ jpeg_destroy_decompress (j_decompress_ptr cinfo) * but don't destroy the object itself. */ -GLOBAL void +GLOBAL(void) jpeg_abort_decompress (j_decompress_ptr cinfo) { jpeg_abort((j_common_ptr) cinfo); /* use common routine */ @@ -96,7 +104,7 @@ jpeg_abort_decompress (j_decompress_ptr cinfo) * Install a special processing method for COM or APPn markers. */ -GLOBAL void +GLOBAL(void) jpeg_set_marker_processor (j_decompress_ptr cinfo, int marker_code, jpeg_marker_parser_method routine) { @@ -113,7 +121,7 @@ jpeg_set_marker_processor (j_decompress_ptr cinfo, int marker_code, * Set default decompression parameters. */ -LOCAL void +LOCAL(void) default_decompress_parms (j_decompress_ptr cinfo) { /* Guess the input colorspace, and set output colorspace accordingly. */ @@ -240,7 +248,7 @@ default_decompress_parms (j_decompress_ptr cinfo) * extra error checking. */ -GLOBAL int +GLOBAL(int) jpeg_read_header (j_decompress_ptr cinfo, boolean require_image) { int retcode; @@ -286,7 +294,7 @@ jpeg_read_header (j_decompress_ptr cinfo, boolean require_image) * method. */ -GLOBAL int +GLOBAL(int) jpeg_consume_input (j_decompress_ptr cinfo) { int retcode = JPEG_SUSPENDED; @@ -333,7 +341,7 @@ jpeg_consume_input (j_decompress_ptr cinfo) * Have we finished reading the input file? */ -GLOBAL boolean +GLOBAL(boolean) jpeg_input_complete (j_decompress_ptr cinfo) { /* Check for valid jpeg object */ @@ -348,7 +356,7 @@ jpeg_input_complete (j_decompress_ptr cinfo) * Is there more than one scan? */ -GLOBAL boolean +GLOBAL(boolean) jpeg_has_multiple_scans (j_decompress_ptr cinfo) { /* Only valid after jpeg_read_header completes */ @@ -368,7 +376,7 @@ jpeg_has_multiple_scans (j_decompress_ptr cinfo) * a suspending data source is used. */ -GLOBAL boolean +GLOBAL(boolean) jpeg_finish_decompress (j_decompress_ptr cinfo) { if ((cinfo->global_state == DSTATE_SCANNING || diff --git a/jdapistd.c b/jdapistd.c index e36f25c..c8e3fa0 100644 --- a/jdapistd.c +++ b/jdapistd.c @@ -1,7 +1,7 @@ /* * jdapistd.c * - * Copyright (C) 1994-1995, Thomas G. Lane. + * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -20,7 +20,7 @@ /* Forward declarations */ -LOCAL boolean output_pass_setup JPP((j_decompress_ptr cinfo)); +LOCAL(boolean) output_pass_setup JPP((j_decompress_ptr cinfo)); /* @@ -34,7 +34,7 @@ LOCAL boolean output_pass_setup JPP((j_decompress_ptr cinfo)); * a suspending data source is used. */ -GLOBAL boolean +GLOBAL(boolean) jpeg_start_decompress (j_decompress_ptr cinfo) { if (cinfo->global_state == DSTATE_READY) { @@ -91,7 +91,7 @@ jpeg_start_decompress (j_decompress_ptr cinfo) * If suspended, returns FALSE and sets global_state = DSTATE_PRESCAN. */ -LOCAL boolean +LOCAL(boolean) output_pass_setup (j_decompress_ptr cinfo) { if (cinfo->global_state != DSTATE_PRESCAN) { @@ -148,7 +148,7 @@ output_pass_setup (j_decompress_ptr cinfo) * an oversize buffer (max_lines > scanlines remaining) is not an error. */ -GLOBAL JDIMENSION +GLOBAL(JDIMENSION) jpeg_read_scanlines (j_decompress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION max_lines) { @@ -181,7 +181,7 @@ jpeg_read_scanlines (j_decompress_ptr cinfo, JSAMPARRAY scanlines, * Processes exactly one iMCU row per call, unless suspended. */ -GLOBAL JDIMENSION +GLOBAL(JDIMENSION) jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data, JDIMENSION max_lines) { @@ -224,7 +224,7 @@ jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data, * Initialize for an output pass in buffered-image mode. */ -GLOBAL boolean +GLOBAL(boolean) jpeg_start_output (j_decompress_ptr cinfo, int scan_number) { if (cinfo->global_state != DSTATE_BUFIMAGE && @@ -249,7 +249,7 @@ jpeg_start_output (j_decompress_ptr cinfo, int scan_number) * a suspending data source is used. */ -GLOBAL boolean +GLOBAL(boolean) jpeg_finish_output (j_decompress_ptr cinfo) { if ((cinfo->global_state == DSTATE_SCANNING || diff --git a/jdatadst.c b/jdatadst.c index 08c4daf..a8f6fb0 100644 --- a/jdatadst.c +++ b/jdatadst.c @@ -1,7 +1,7 @@ /* * jdatadst.c * - * Copyright (C) 1994, Thomas G. Lane. + * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -39,7 +39,7 @@ typedef my_destination_mgr * my_dest_ptr; * before any data is actually written. */ -METHODDEF void +METHODDEF(void) init_destination (j_compress_ptr cinfo) { my_dest_ptr dest = (my_dest_ptr) cinfo->dest; @@ -77,7 +77,7 @@ init_destination (j_compress_ptr cinfo) * write it out when emptying the buffer externally. */ -METHODDEF boolean +METHODDEF(boolean) empty_output_buffer (j_compress_ptr cinfo) { my_dest_ptr dest = (my_dest_ptr) cinfo->dest; @@ -102,7 +102,7 @@ empty_output_buffer (j_compress_ptr cinfo) * for error exit. */ -METHODDEF void +METHODDEF(void) term_destination (j_compress_ptr cinfo) { my_dest_ptr dest = (my_dest_ptr) cinfo->dest; @@ -126,7 +126,7 @@ term_destination (j_compress_ptr cinfo) * for closing it after finishing compression. */ -GLOBAL void +GLOBAL(void) jpeg_stdio_dest (j_compress_ptr cinfo, FILE * outfile) { my_dest_ptr dest; diff --git a/jdatasrc.c b/jdatasrc.c index 8c4ac0b..edc752b 100644 --- a/jdatasrc.c +++ b/jdatasrc.c @@ -1,7 +1,7 @@ /* * jdatasrc.c * - * Copyright (C) 1994, Thomas G. Lane. + * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -40,7 +40,7 @@ typedef my_source_mgr * my_src_ptr; * before any data is actually read. */ -METHODDEF void +METHODDEF(void) init_source (j_decompress_ptr cinfo) { my_src_ptr src = (my_src_ptr) cinfo->src; @@ -86,7 +86,7 @@ init_source (j_decompress_ptr cinfo) * the front of the buffer rather than discarding it. */ -METHODDEF boolean +METHODDEF(boolean) fill_input_buffer (j_decompress_ptr cinfo) { my_src_ptr src = (my_src_ptr) cinfo->src; @@ -124,7 +124,7 @@ fill_input_buffer (j_decompress_ptr cinfo) * buffer is the application writer's problem. */ -METHODDEF void +METHODDEF(void) skip_input_data (j_decompress_ptr cinfo, long num_bytes) { my_src_ptr src = (my_src_ptr) cinfo->src; @@ -165,7 +165,7 @@ skip_input_data (j_decompress_ptr cinfo, long num_bytes) * for error exit. */ -METHODDEF void +METHODDEF(void) term_source (j_decompress_ptr cinfo) { /* no work necessary here */ @@ -178,7 +178,7 @@ term_source (j_decompress_ptr cinfo) * for closing it after finishing decompression. */ -GLOBAL void +GLOBAL(void) jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile) { my_src_ptr src; diff --git a/jdcoefct.c b/jdcoefct.c index ba153f5..c0cd0bd 100644 --- a/jdcoefct.c +++ b/jdcoefct.c @@ -1,7 +1,7 @@ /* * jdcoefct.c * - * Copyright (C) 1994-1995, Thomas G. Lane. + * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -62,20 +62,20 @@ typedef struct { typedef my_coef_controller * my_coef_ptr; /* Forward declarations */ -METHODDEF int decompress_onepass +METHODDEF(int) decompress_onepass JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); #ifdef D_MULTISCAN_FILES_SUPPORTED -METHODDEF int decompress_data +METHODDEF(int) decompress_data JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); #endif #ifdef BLOCK_SMOOTHING_SUPPORTED -LOCAL boolean smoothing_ok JPP((j_decompress_ptr cinfo)); -METHODDEF int decompress_smooth_data +LOCAL(boolean) smoothing_ok JPP((j_decompress_ptr cinfo)); +METHODDEF(int) decompress_smooth_data JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); #endif -LOCAL void +LOCAL(void) start_iMCU_row (j_decompress_ptr cinfo) /* Reset within-iMCU-row counters for a new row (input side) */ { @@ -103,7 +103,7 @@ start_iMCU_row (j_decompress_ptr cinfo) * Initialize for an input processing pass. */ -METHODDEF void +METHODDEF(void) start_input_pass (j_decompress_ptr cinfo) { cinfo->input_iMCU_row = 0; @@ -115,7 +115,7 @@ start_input_pass (j_decompress_ptr cinfo) * Initialize for an output processing pass. */ -METHODDEF void +METHODDEF(void) start_output_pass (j_decompress_ptr cinfo) { #ifdef BLOCK_SMOOTHING_SUPPORTED @@ -143,7 +143,7 @@ start_output_pass (j_decompress_ptr cinfo) * For single pass, this is the same as the components in the scan. */ -METHODDEF int +METHODDEF(int) decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) { my_coef_ptr coef = (my_coef_ptr) cinfo->coef; @@ -223,7 +223,7 @@ decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) * Dummy consume-input routine for single-pass operation. */ -METHODDEF int +METHODDEF(int) dummy_consume_data (j_decompress_ptr cinfo) { return JPEG_SUSPENDED; /* Always indicate nothing was done */ @@ -239,7 +239,7 @@ dummy_consume_data (j_decompress_ptr cinfo) * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED. */ -METHODDEF int +METHODDEF(int) consume_data (j_decompress_ptr cinfo) { my_coef_ptr coef = (my_coef_ptr) cinfo->coef; @@ -310,7 +310,7 @@ consume_data (j_decompress_ptr cinfo) * NB: output_buf contains a plane for each component in image. */ -METHODDEF int +METHODDEF(int) decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) { my_coef_ptr coef = (my_coef_ptr) cinfo->coef; @@ -385,6 +385,13 @@ decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) * the coefficients it can estimate are not yet known to full precision. */ +/* Natural-order array positions of the first 5 zigzag-order coefficients */ +#define Q01_POS 1 +#define Q10_POS 8 +#define Q20_POS 16 +#define Q11_POS 9 +#define Q02_POS 2 + /* * Determine whether block smoothing is applicable and safe. * We also latch the current states of the coef_bits[] entries for the @@ -393,7 +400,7 @@ decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) * more accurately than they really are. */ -LOCAL boolean +LOCAL(boolean) smoothing_ok (j_decompress_ptr cinfo) { my_coef_ptr coef = (my_coef_ptr) cinfo->coef; @@ -421,10 +428,13 @@ smoothing_ok (j_decompress_ptr cinfo) if ((qtable = compptr->quant_table) == NULL) return FALSE; /* Verify DC & first 5 AC quantizers are nonzero to avoid zero-divide. */ - for (coefi = 0; coefi <= 5; coefi++) { - if (qtable->quantval[coefi] == 0) - return FALSE; - } + if (qtable->quantval[0] == 0 || + qtable->quantval[Q01_POS] == 0 || + qtable->quantval[Q10_POS] == 0 || + qtable->quantval[Q20_POS] == 0 || + qtable->quantval[Q11_POS] == 0 || + qtable->quantval[Q02_POS] == 0) + return FALSE; /* DC values must be at least partly known for all components. */ coef_bits = cinfo->coef_bits[ci]; if (coef_bits[0] < 0) @@ -446,7 +456,7 @@ smoothing_ok (j_decompress_ptr cinfo) * Variant of decompress_data for use when doing block smoothing. */ -METHODDEF int +METHODDEF(int) decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) { my_coef_ptr coef = (my_coef_ptr) cinfo->coef; @@ -521,11 +531,11 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) coef_bits = coef->coef_bits_latch + (ci * SAVED_COEFS); quanttbl = compptr->quant_table; Q00 = quanttbl->quantval[0]; - Q01 = quanttbl->quantval[1]; - Q10 = quanttbl->quantval[2]; - Q20 = quanttbl->quantval[3]; - Q11 = quanttbl->quantval[4]; - Q02 = quanttbl->quantval[5]; + Q01 = quanttbl->quantval[Q01_POS]; + Q10 = quanttbl->quantval[Q10_POS]; + Q20 = quanttbl->quantval[Q20_POS]; + Q11 = quanttbl->quantval[Q11_POS]; + Q02 = quanttbl->quantval[Q02_POS]; inverse_DCT = cinfo->idct->inverse_DCT[ci]; output_ptr = output_buf[ci]; /* Loop over all DCT blocks to be processed. */ @@ -661,7 +671,7 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) * Initialize coefficient buffer controller. */ -GLOBAL void +GLOBAL(void) jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer) { my_coef_ptr coef; diff --git a/jdcolor.c b/jdcolor.c index b2bdf6e..0269498 100644 --- a/jdcolor.c +++ b/jdcolor.c @@ -1,7 +1,7 @@ /* * jdcolor.c * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -66,7 +66,7 @@ typedef my_color_deconverter * my_cconvert_ptr; * Initialize tables for YCC->RGB colorspace conversion. */ -LOCAL void +LOCAL(void) build_ycc_rgb_table (j_decompress_ptr cinfo) { my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; @@ -116,7 +116,7 @@ build_ycc_rgb_table (j_decompress_ptr cinfo) * offset required on that side. */ -METHODDEF void +METHODDEF(void) ycc_rgb_convert (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows) @@ -165,7 +165,7 @@ ycc_rgb_convert (j_decompress_ptr cinfo, * converting from separate-planes to interleaved representation. */ -METHODDEF void +METHODDEF(void) null_convert (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows) @@ -197,7 +197,7 @@ null_convert (j_decompress_ptr cinfo, * we just copy the Y (luminance) component and ignore chrominance. */ -METHODDEF void +METHODDEF(void) grayscale_convert (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows) @@ -214,7 +214,7 @@ grayscale_convert (j_decompress_ptr cinfo, * We assume build_ycc_rgb_table has been called. */ -METHODDEF void +METHODDEF(void) ycck_cmyk_convert (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows) @@ -262,7 +262,7 @@ ycck_cmyk_convert (j_decompress_ptr cinfo, * Empty method for start_pass. */ -METHODDEF void +METHODDEF(void) start_pass_dcolor (j_decompress_ptr cinfo) { /* no work needed */ @@ -273,7 +273,7 @@ start_pass_dcolor (j_decompress_ptr cinfo) * Module initialization routine for output colorspace conversion. */ -GLOBAL void +GLOBAL(void) jinit_color_deconverter (j_decompress_ptr cinfo) { my_cconvert_ptr cconvert; diff --git a/jdct.h b/jdct.h index 3ce790b..04192a2 100644 --- a/jdct.h +++ b/jdct.h @@ -1,7 +1,7 @@ /* * jdct.h * - * Copyright (C) 1994, Thomas G. Lane. + * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -94,26 +94,26 @@ typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */ /* Extern declarations for the forward and inverse DCT routines. */ -EXTERN void jpeg_fdct_islow JPP((DCTELEM * data)); -EXTERN void jpeg_fdct_ifast JPP((DCTELEM * data)); -EXTERN void jpeg_fdct_float JPP((FAST_FLOAT * data)); +EXTERN(void) jpeg_fdct_islow JPP((DCTELEM * data)); +EXTERN(void) jpeg_fdct_ifast JPP((DCTELEM * data)); +EXTERN(void) jpeg_fdct_float JPP((FAST_FLOAT * data)); -EXTERN void jpeg_idct_islow +EXTERN(void) jpeg_idct_islow JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); -EXTERN void jpeg_idct_ifast +EXTERN(void) jpeg_idct_ifast JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); -EXTERN void jpeg_idct_float +EXTERN(void) jpeg_idct_float JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); -EXTERN void jpeg_idct_4x4 +EXTERN(void) jpeg_idct_4x4 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); -EXTERN void jpeg_idct_2x2 +EXTERN(void) jpeg_idct_2x2 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); -EXTERN void jpeg_idct_1x1 +EXTERN(void) jpeg_idct_1x1 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); diff --git a/jddctmgr.c b/jddctmgr.c index 71215f1..bbf8d0e 100644 --- a/jddctmgr.c +++ b/jddctmgr.c @@ -1,7 +1,7 @@ /* * jddctmgr.c * - * Copyright (C) 1994-1995, Thomas G. Lane. + * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -85,7 +85,7 @@ typedef union { * a matching multiplier table. */ -METHODDEF void +METHODDEF(void) start_pass (j_decompress_ptr cinfo) { my_idct_ptr idct = (my_idct_ptr) cinfo->idct; @@ -161,11 +161,11 @@ start_pass (j_decompress_ptr cinfo) case JDCT_ISLOW: { /* For LL&M IDCT method, multipliers are equal to raw quantization - * coefficients, but are stored in natural order as ints. + * coefficients, but are stored as ints to ensure access efficiency. */ ISLOW_MULT_TYPE * ismtbl = (ISLOW_MULT_TYPE *) compptr->dct_table; for (i = 0; i < DCTSIZE2; i++) { - ismtbl[i] = (ISLOW_MULT_TYPE) qtbl->quantval[jpeg_zigzag_order[i]]; + ismtbl[i] = (ISLOW_MULT_TYPE) qtbl->quantval[i]; } } break; @@ -178,7 +178,7 @@ start_pass (j_decompress_ptr cinfo) * scalefactor[0] = 1 * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 * For integer operation, the multiplier table is to be scaled by - * IFAST_SCALE_BITS. The multipliers are stored in natural order. + * IFAST_SCALE_BITS. */ IFAST_MULT_TYPE * ifmtbl = (IFAST_MULT_TYPE *) compptr->dct_table; #define CONST_BITS 14 @@ -197,7 +197,7 @@ start_pass (j_decompress_ptr cinfo) for (i = 0; i < DCTSIZE2; i++) { ifmtbl[i] = (IFAST_MULT_TYPE) - DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[jpeg_zigzag_order[i]], + DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i], (INT32) aanscales[i]), CONST_BITS-IFAST_SCALE_BITS); } @@ -211,7 +211,6 @@ start_pass (j_decompress_ptr cinfo) * coefficients scaled by scalefactor[row]*scalefactor[col], where * scalefactor[0] = 1 * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 - * The multipliers are stored in natural order. */ FLOAT_MULT_TYPE * fmtbl = (FLOAT_MULT_TYPE *) compptr->dct_table; int row, col; @@ -224,7 +223,7 @@ start_pass (j_decompress_ptr cinfo) for (row = 0; row < DCTSIZE; row++) { for (col = 0; col < DCTSIZE; col++) { fmtbl[i] = (FLOAT_MULT_TYPE) - ((double) qtbl->quantval[jpeg_zigzag_order[i]] * + ((double) qtbl->quantval[i] * aanscalefactor[row] * aanscalefactor[col]); i++; } @@ -244,7 +243,7 @@ start_pass (j_decompress_ptr cinfo) * Initialize IDCT manager. */ -GLOBAL void +GLOBAL(void) jinit_inverse_dct (j_decompress_ptr cinfo) { my_idct_ptr idct; diff --git a/jdhuff.c b/jdhuff.c index 95174b1..5b5544b 100644 --- a/jdhuff.c +++ b/jdhuff.c @@ -1,7 +1,7 @@ /* * jdhuff.c * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -73,7 +73,7 @@ typedef huff_entropy_decoder * huff_entropy_ptr; * Initialize for a Huffman-compressed scan. */ -METHODDEF void +METHODDEF(void) start_pass_huff_decoder (j_decompress_ptr cinfo) { huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; @@ -124,7 +124,7 @@ start_pass_huff_decoder (j_decompress_ptr cinfo) * Note this is also used by jdphuff.c. */ -GLOBAL void +GLOBAL(void) jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, JHUFF_TBL * htbl, d_derived_tbl ** pdtbl) { @@ -230,7 +230,7 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, JHUFF_TBL * htbl, #endif -GLOBAL boolean +GLOBAL(boolean) jpeg_fill_bit_buffer (bitread_working_state * state, register bit_buf_type get_buffer, register int bits_left, int nbits) @@ -318,7 +318,7 @@ jpeg_fill_bit_buffer (bitread_working_state * state, * See jdhuff.h for info about usage. */ -GLOBAL int +GLOBAL(int) jpeg_huff_decode (bitread_working_state * state, register bit_buf_type get_buffer, register int bits_left, d_derived_tbl * htbl, int min_bits) @@ -389,7 +389,7 @@ static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */ * Returns FALSE if must suspend. */ -LOCAL boolean +LOCAL(boolean) process_restart (j_decompress_ptr cinfo) { huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; @@ -433,7 +433,7 @@ process_restart (j_decompress_ptr cinfo) * this module, since we'll just re-assign them on the next call.) */ -METHODDEF boolean +METHODDEF(boolean) decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) { huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; @@ -554,7 +554,7 @@ skip_ACs: * Module initialization routine for Huffman entropy decoding. */ -GLOBAL void +GLOBAL(void) jinit_huff_decoder (j_decompress_ptr cinfo) { huff_entropy_ptr entropy; diff --git a/jdhuff.h b/jdhuff.h index d375c78..bcc3ab1 100644 --- a/jdhuff.h +++ b/jdhuff.h @@ -1,7 +1,7 @@ /* * jdhuff.h * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -43,7 +43,7 @@ typedef struct { } d_derived_tbl; /* Expand a Huffman table definition into the derived format */ -EXTERN void jpeg_make_d_derived_tbl JPP((j_decompress_ptr cinfo, +EXTERN(void) jpeg_make_d_derived_tbl JPP((j_decompress_ptr cinfo, JHUFF_TBL * htbl, d_derived_tbl ** pdtbl)); @@ -152,9 +152,9 @@ typedef struct { /* Bitreading working state within an MCU */ (bits_left -= (nbits)) /* Load up the bit buffer to a depth of at least nbits */ -EXTERN boolean jpeg_fill_bit_buffer JPP((bitread_working_state * state, - register bit_buf_type get_buffer, register int bits_left, - int nbits)); +EXTERN(boolean) jpeg_fill_bit_buffer + JPP((bitread_working_state * state, register bit_buf_type get_buffer, + register int bits_left, int nbits)); /* @@ -197,6 +197,6 @@ slowlabel: \ } /* Out-of-line case for Huffman code fetching */ -EXTERN int jpeg_huff_decode JPP((bitread_working_state * state, - register bit_buf_type get_buffer, register int bits_left, - d_derived_tbl * htbl, int min_bits)); +EXTERN(int) jpeg_huff_decode + JPP((bitread_working_state * state, register bit_buf_type get_buffer, + register int bits_left, d_derived_tbl * htbl, int min_bits)); diff --git a/jdinput.c b/jdinput.c index 3061a17..a8565c5 100644 --- a/jdinput.c +++ b/jdinput.c @@ -1,7 +1,7 @@ /* * jdinput.c * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -28,14 +28,14 @@ typedef my_input_controller * my_inputctl_ptr; /* Forward declarations */ -METHODDEF int consume_markers JPP((j_decompress_ptr cinfo)); +METHODDEF(int) consume_markers JPP((j_decompress_ptr cinfo)); /* * Routines to calculate various quantities related to the size of the image. */ -LOCAL void +LOCAL(void) initial_setup (j_decompress_ptr cinfo) /* Called once, when first SOS marker is reached */ { @@ -117,7 +117,7 @@ initial_setup (j_decompress_ptr cinfo) } -LOCAL void +LOCAL(void) per_scan_setup (j_decompress_ptr cinfo) /* Do computations that are needed before processing a JPEG scan */ /* cinfo->comps_in_scan and cinfo->cur_comp_info[] were set from SOS marker */ @@ -216,7 +216,7 @@ per_scan_setup (j_decompress_ptr cinfo) * not at the current Q-table slots. */ -LOCAL void +LOCAL(void) latch_quant_tables (j_decompress_ptr cinfo) { int ci, qtblno; @@ -250,7 +250,7 @@ latch_quant_tables (j_decompress_ptr cinfo) * Subsequent calls come from consume_markers, below. */ -METHODDEF void +METHODDEF(void) start_input_pass (j_decompress_ptr cinfo) { per_scan_setup(cinfo); @@ -267,7 +267,7 @@ start_input_pass (j_decompress_ptr cinfo) * the expected data of the scan. */ -METHODDEF void +METHODDEF(void) finish_input_pass (j_decompress_ptr cinfo) { cinfo->inputctl->consume_input = consume_markers; @@ -284,7 +284,7 @@ finish_input_pass (j_decompress_ptr cinfo) * we are reading a compressed data segment or inter-segment markers. */ -METHODDEF int +METHODDEF(int) consume_markers (j_decompress_ptr cinfo) { my_inputctl_ptr inputctl = (my_inputctl_ptr) cinfo->inputctl; @@ -335,7 +335,7 @@ consume_markers (j_decompress_ptr cinfo) * Reset state to begin a fresh datastream. */ -METHODDEF void +METHODDEF(void) reset_input_controller (j_decompress_ptr cinfo) { my_inputctl_ptr inputctl = (my_inputctl_ptr) cinfo->inputctl; @@ -357,7 +357,7 @@ reset_input_controller (j_decompress_ptr cinfo) * This is called only once, when the decompression object is created. */ -GLOBAL void +GLOBAL(void) jinit_input_controller (j_decompress_ptr cinfo) { my_inputctl_ptr inputctl; diff --git a/jdmainct.c b/jdmainct.c index f3a06e5..13c956f 100644 --- a/jdmainct.c +++ b/jdmainct.c @@ -1,7 +1,7 @@ /* * jdmainct.c * - * Copyright (C) 1994-1995, Thomas G. Lane. + * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -140,20 +140,20 @@ typedef my_main_controller * my_main_ptr; /* Forward declarations */ -METHODDEF void process_data_simple_main +METHODDEF(void) process_data_simple_main JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); -METHODDEF void process_data_context_main +METHODDEF(void) process_data_context_main JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); #ifdef QUANT_2PASS_SUPPORTED -METHODDEF void process_data_crank_post +METHODDEF(void) process_data_crank_post JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); #endif -LOCAL void +LOCAL(void) alloc_funny_pointers (j_decompress_ptr cinfo) /* Allocate space for the funny pointer lists. * This is done only once, not once per pass. @@ -191,7 +191,7 @@ alloc_funny_pointers (j_decompress_ptr cinfo) } -LOCAL void +LOCAL(void) make_funny_pointers (j_decompress_ptr cinfo) /* Create the funny pointer lists discussed in the comments above. * The actual workspace is already allocated (in main->buffer), @@ -234,7 +234,7 @@ make_funny_pointers (j_decompress_ptr cinfo) } -LOCAL void +LOCAL(void) set_wraparound_pointers (j_decompress_ptr cinfo) /* Set up the "wraparound" pointers at top and bottom of the pointer lists. * This changes the pointer list state from top-of-image to the normal state. @@ -262,7 +262,7 @@ set_wraparound_pointers (j_decompress_ptr cinfo) } -LOCAL void +LOCAL(void) set_bottom_pointers (j_decompress_ptr cinfo) /* Change the pointer lists to duplicate the last sample row at the bottom * of the image. whichptr indicates which xbuffer holds the final iMCU row. @@ -303,7 +303,7 @@ set_bottom_pointers (j_decompress_ptr cinfo) * Initialize for a processing pass. */ -METHODDEF void +METHODDEF(void) start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode) { my_main_ptr main = (my_main_ptr) cinfo->main; @@ -341,7 +341,7 @@ start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode) * This handles the simple case where no context is required. */ -METHODDEF void +METHODDEF(void) process_data_simple_main (j_decompress_ptr cinfo, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail) @@ -381,7 +381,7 @@ process_data_simple_main (j_decompress_ptr cinfo, * This handles the case where context rows must be provided. */ -METHODDEF void +METHODDEF(void) process_data_context_main (j_decompress_ptr cinfo, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail) @@ -455,7 +455,7 @@ process_data_context_main (j_decompress_ptr cinfo, #ifdef QUANT_2PASS_SUPPORTED -METHODDEF void +METHODDEF(void) process_data_crank_post (j_decompress_ptr cinfo, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail) @@ -472,7 +472,7 @@ process_data_crank_post (j_decompress_ptr cinfo, * Initialize main buffer controller. */ -GLOBAL void +GLOBAL(void) jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer) { my_main_ptr main; diff --git a/jdmarker.c b/jdmarker.c index 80e5f78..b79ec37 100644 --- a/jdmarker.c +++ b/jdmarker.c @@ -1,7 +1,7 @@ /* * jdmarker.c * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -162,7 +162,7 @@ typedef enum { /* JPEG marker codes */ */ -LOCAL boolean +LOCAL(boolean) get_soi (j_decompress_ptr cinfo) /* Process an SOI marker */ { @@ -200,7 +200,7 @@ get_soi (j_decompress_ptr cinfo) } -LOCAL boolean +LOCAL(boolean) get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith) /* Process a SOFn marker */ { @@ -264,7 +264,7 @@ get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith) } -LOCAL boolean +LOCAL(boolean) get_sos (j_decompress_ptr cinfo) /* Process a SOS marker */ { @@ -334,7 +334,7 @@ get_sos (j_decompress_ptr cinfo) } -METHODDEF boolean +METHODDEF(boolean) get_app0 (j_decompress_ptr cinfo) /* Process an APP0 marker */ { @@ -393,7 +393,7 @@ get_app0 (j_decompress_ptr cinfo) } -METHODDEF boolean +METHODDEF(boolean) get_app14 (j_decompress_ptr cinfo) /* Process an APP14 marker */ { @@ -440,7 +440,7 @@ get_app14 (j_decompress_ptr cinfo) } -LOCAL boolean +LOCAL(boolean) get_dac (j_decompress_ptr cinfo) /* Process a DAC marker */ { @@ -477,7 +477,7 @@ get_dac (j_decompress_ptr cinfo) } -LOCAL boolean +LOCAL(boolean) get_dht (j_decompress_ptr cinfo) /* Process a DHT marker */ { @@ -542,7 +542,7 @@ get_dht (j_decompress_ptr cinfo) } -LOCAL boolean +LOCAL(boolean) get_dqt (j_decompress_ptr cinfo) /* Process a DQT marker */ { @@ -574,15 +574,18 @@ get_dqt (j_decompress_ptr cinfo) INPUT_2BYTES(cinfo, tmp, return FALSE); else INPUT_BYTE(cinfo, tmp, return FALSE); - quant_ptr->quantval[i] = (UINT16) tmp; + /* We convert the zigzag-order table to natural array order. */ + quant_ptr->quantval[jpeg_natural_order[i]] = (UINT16) tmp; } - for (i = 0; i < DCTSIZE2; i += 8) { - TRACEMS8(cinfo, 2, JTRC_QUANTVALS, - quant_ptr->quantval[i ], quant_ptr->quantval[i+1], - quant_ptr->quantval[i+2], quant_ptr->quantval[i+3], - quant_ptr->quantval[i+4], quant_ptr->quantval[i+5], - quant_ptr->quantval[i+6], quant_ptr->quantval[i+7]); + if (cinfo->err->trace_level >= 2) { + for (i = 0; i < DCTSIZE2; i += 8) { + TRACEMS8(cinfo, 2, JTRC_QUANTVALS, + quant_ptr->quantval[i], quant_ptr->quantval[i+1], + quant_ptr->quantval[i+2], quant_ptr->quantval[i+3], + quant_ptr->quantval[i+4], quant_ptr->quantval[i+5], + quant_ptr->quantval[i+6], quant_ptr->quantval[i+7]); + } } length -= DCTSIZE2+1; @@ -594,7 +597,7 @@ get_dqt (j_decompress_ptr cinfo) } -LOCAL boolean +LOCAL(boolean) get_dri (j_decompress_ptr cinfo) /* Process a DRI marker */ { @@ -618,7 +621,7 @@ get_dri (j_decompress_ptr cinfo) } -METHODDEF boolean +METHODDEF(boolean) skip_variable (j_decompress_ptr cinfo) /* Skip over an unknown or uninteresting variable-length marker */ { @@ -645,7 +648,7 @@ skip_variable (j_decompress_ptr cinfo) * but it will never be 0 or FF. */ -LOCAL boolean +LOCAL(boolean) next_marker (j_decompress_ptr cinfo) { int c; @@ -692,7 +695,7 @@ next_marker (j_decompress_ptr cinfo) } -LOCAL boolean +LOCAL(boolean) first_marker (j_decompress_ptr cinfo) /* Like next_marker, but used to obtain the initial SOI marker. */ /* For this marker, we do not allow preceding garbage or fill; otherwise, @@ -723,7 +726,7 @@ first_marker (j_decompress_ptr cinfo) * JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI. */ -METHODDEF int +METHODDEF(int) read_markers (j_decompress_ptr cinfo) { /* Outer loop repeats once for each marker. */ @@ -883,7 +886,7 @@ read_markers (j_decompress_ptr cinfo) * it holds a marker which the decoder will be unable to read past. */ -METHODDEF boolean +METHODDEF(boolean) read_restart_marker (j_decompress_ptr cinfo) { /* Obtain a marker unless we already did. */ @@ -896,7 +899,7 @@ read_restart_marker (j_decompress_ptr cinfo) if (cinfo->unread_marker == ((int) M_RST0 + cinfo->marker->next_restart_num)) { /* Normal case --- swallow the marker and let entropy decoder continue */ - TRACEMS1(cinfo, 2, JTRC_RST, cinfo->marker->next_restart_num); + TRACEMS1(cinfo, 3, JTRC_RST, cinfo->marker->next_restart_num); cinfo->unread_marker = 0; } else { /* Uh-oh, the restart markers have been messed up. */ @@ -962,7 +965,7 @@ read_restart_marker (j_decompress_ptr cinfo) * any other marker would have to be bogus data in that case. */ -GLOBAL boolean +GLOBAL(boolean) jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired) { int marker = cinfo->unread_marker; @@ -1012,7 +1015,7 @@ jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired) * Reset marker processing state to begin a fresh datastream. */ -METHODDEF void +METHODDEF(void) reset_marker_reader (j_decompress_ptr cinfo) { cinfo->comp_info = NULL; /* until allocated by get_sof */ @@ -1029,7 +1032,7 @@ reset_marker_reader (j_decompress_ptr cinfo) * This is called only once, when the decompression object is created. */ -GLOBAL void +GLOBAL(void) jinit_marker_reader (j_decompress_ptr cinfo) { int i; diff --git a/jdmaster.c b/jdmaster.c index 4484b34..6f3351e 100644 --- a/jdmaster.c +++ b/jdmaster.c @@ -1,7 +1,7 @@ /* * jdmaster.c * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -40,7 +40,7 @@ typedef my_decomp_master * my_master_ptr; * CRUCIAL: this must match the actual capabilities of jdmerge.c! */ -LOCAL boolean +LOCAL(boolean) use_merged_upsample (j_decompress_ptr cinfo) { #ifdef UPSAMPLE_MERGING_SUPPORTED @@ -80,7 +80,7 @@ use_merged_upsample (j_decompress_ptr cinfo) * Also note that it may be called before the master module is initialized! */ -GLOBAL void +GLOBAL(void) jpeg_calc_output_dimensions (j_decompress_ptr cinfo) /* Do computations that are needed before master selection phase */ { @@ -242,7 +242,7 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo) * enough and used often enough to justify this. */ -LOCAL void +LOCAL(void) prepare_range_limit_table (j_decompress_ptr cinfo) /* Allocate and fill in the sample_range_limit table */ { @@ -282,7 +282,7 @@ prepare_range_limit_table (j_decompress_ptr cinfo) * settings. */ -LOCAL void +LOCAL(void) master_selection (j_decompress_ptr cinfo) { my_master_ptr master = (my_master_ptr) cinfo->master; @@ -432,7 +432,7 @@ master_selection (j_decompress_ptr cinfo) * (In the latter case, jdapi.c will crank the pass to completion.) */ -METHODDEF void +METHODDEF(void) prepare_for_output_pass (j_decompress_ptr cinfo) { my_master_ptr master = (my_master_ptr) cinfo->master; @@ -492,7 +492,7 @@ prepare_for_output_pass (j_decompress_ptr cinfo) * Finish up at end of an output pass. */ -METHODDEF void +METHODDEF(void) finish_output_pass (j_decompress_ptr cinfo) { my_master_ptr master = (my_master_ptr) cinfo->master; @@ -509,7 +509,7 @@ finish_output_pass (j_decompress_ptr cinfo) * Switch to a new external colormap between output passes. */ -GLOBAL void +GLOBAL(void) jpeg_new_colormap (j_decompress_ptr cinfo) { my_master_ptr master = (my_master_ptr) cinfo->master; @@ -537,7 +537,7 @@ jpeg_new_colormap (j_decompress_ptr cinfo) * This is performed at the start of jpeg_start_decompress. */ -GLOBAL void +GLOBAL(void) jinit_master_decompress (j_decompress_ptr cinfo) { my_master_ptr master; diff --git a/jdmerge.c b/jdmerge.c index 95585fb..3744446 100644 --- a/jdmerge.c +++ b/jdmerge.c @@ -1,7 +1,7 @@ /* * jdmerge.c * - * Copyright (C) 1994-1995, Thomas G. Lane. + * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -79,7 +79,7 @@ typedef my_upsampler * my_upsample_ptr; * This is taken directly from jdcolor.c; see that file for more info. */ -LOCAL void +LOCAL(void) build_ycc_rgb_table (j_decompress_ptr cinfo) { my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; @@ -122,7 +122,7 @@ build_ycc_rgb_table (j_decompress_ptr cinfo) * Initialize for an upsampling pass. */ -METHODDEF void +METHODDEF(void) start_pass_merged_upsample (j_decompress_ptr cinfo) { my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; @@ -140,7 +140,7 @@ start_pass_merged_upsample (j_decompress_ptr cinfo) * The control routine just handles the row buffering considerations. */ -METHODDEF void +METHODDEF(void) merged_2v_upsample (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, @@ -189,7 +189,7 @@ merged_2v_upsample (j_decompress_ptr cinfo, } -METHODDEF void +METHODDEF(void) merged_1v_upsample (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, @@ -222,7 +222,7 @@ merged_1v_upsample (j_decompress_ptr cinfo, * Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical. */ -METHODDEF void +METHODDEF(void) h2v1_merged_upsample (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf) @@ -284,7 +284,7 @@ h2v1_merged_upsample (j_decompress_ptr cinfo, * Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical. */ -METHODDEF void +METHODDEF(void) h2v2_merged_upsample (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf) @@ -366,7 +366,7 @@ h2v2_merged_upsample (j_decompress_ptr cinfo, * of this module; no safety checks are made here. */ -GLOBAL void +GLOBAL(void) jinit_merged_upsampler (j_decompress_ptr cinfo) { my_upsample_ptr upsample; diff --git a/jdphuff.c b/jdphuff.c index 025bfd8..f6a89f3 100644 --- a/jdphuff.c +++ b/jdphuff.c @@ -1,7 +1,7 @@ /* * jdphuff.c * - * Copyright (C) 1995, Thomas G. Lane. + * Copyright (C) 1995-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -74,21 +74,21 @@ typedef struct { typedef phuff_entropy_decoder * phuff_entropy_ptr; /* Forward declarations */ -METHODDEF boolean decode_mcu_DC_first JPP((j_decompress_ptr cinfo, - JBLOCKROW *MCU_data)); -METHODDEF boolean decode_mcu_AC_first JPP((j_decompress_ptr cinfo, - JBLOCKROW *MCU_data)); -METHODDEF boolean decode_mcu_DC_refine JPP((j_decompress_ptr cinfo, +METHODDEF(boolean) decode_mcu_DC_first JPP((j_decompress_ptr cinfo, JBLOCKROW *MCU_data)); -METHODDEF boolean decode_mcu_AC_refine JPP((j_decompress_ptr cinfo, +METHODDEF(boolean) decode_mcu_AC_first JPP((j_decompress_ptr cinfo, JBLOCKROW *MCU_data)); +METHODDEF(boolean) decode_mcu_DC_refine JPP((j_decompress_ptr cinfo, + JBLOCKROW *MCU_data)); +METHODDEF(boolean) decode_mcu_AC_refine JPP((j_decompress_ptr cinfo, + JBLOCKROW *MCU_data)); /* * Initialize for a Huffman-compressed scan. */ -METHODDEF void +METHODDEF(void) start_pass_phuff_decoder (j_decompress_ptr cinfo) { phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; @@ -224,7 +224,7 @@ static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */ * Returns FALSE if must suspend. */ -LOCAL boolean +LOCAL(boolean) process_restart (j_decompress_ptr cinfo) { phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; @@ -277,7 +277,7 @@ process_restart (j_decompress_ptr cinfo) * or first pass of successive approximation). */ -METHODDEF boolean +METHODDEF(boolean) decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) { phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; @@ -342,7 +342,7 @@ decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) * or first pass of successive approximation). */ -METHODDEF boolean +METHODDEF(boolean) decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) { phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; @@ -421,7 +421,7 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) * is not very clear on the point. */ -METHODDEF boolean +METHODDEF(boolean) decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) { phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; @@ -466,7 +466,7 @@ decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) * MCU decoding for AC successive approximation refinement scan. */ -METHODDEF boolean +METHODDEF(boolean) decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) { phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; @@ -611,7 +611,7 @@ undoit: * Module initialization routine for progressive Huffman entropy decoding. */ -GLOBAL void +GLOBAL(void) jinit_phuff_decoder (j_decompress_ptr cinfo) { phuff_entropy_ptr entropy; diff --git a/jdpostct.c b/jdpostct.c index f612002..571563d 100644 --- a/jdpostct.c +++ b/jdpostct.c @@ -1,7 +1,7 @@ /* * jdpostct.c * - * Copyright (C) 1994-1995, Thomas G. Lane. + * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -43,20 +43,20 @@ typedef my_post_controller * my_post_ptr; /* Forward declarations */ -METHODDEF void post_process_1pass +METHODDEF(void) post_process_1pass JPP((j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); #ifdef QUANT_2PASS_SUPPORTED -METHODDEF void post_process_prepass +METHODDEF(void) post_process_prepass JPP((j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); -METHODDEF void post_process_2pass +METHODDEF(void) post_process_2pass JPP((j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, @@ -69,7 +69,7 @@ METHODDEF void post_process_2pass * Initialize for a processing pass. */ -METHODDEF void +METHODDEF(void) start_pass_dpost (j_decompress_ptr cinfo, J_BUF_MODE pass_mode) { my_post_ptr post = (my_post_ptr) cinfo->post; @@ -122,7 +122,7 @@ start_pass_dpost (j_decompress_ptr cinfo, J_BUF_MODE pass_mode) * This is used for color precision reduction as well as one-pass quantization. */ -METHODDEF void +METHODDEF(void) post_process_1pass (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, @@ -154,7 +154,7 @@ post_process_1pass (j_decompress_ptr cinfo, * Process some data in the first pass of 2-pass quantization. */ -METHODDEF void +METHODDEF(void) post_process_prepass (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, @@ -198,7 +198,7 @@ post_process_prepass (j_decompress_ptr cinfo, * Process some data in the second pass of 2-pass quantization. */ -METHODDEF void +METHODDEF(void) post_process_2pass (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, @@ -246,7 +246,7 @@ post_process_2pass (j_decompress_ptr cinfo, * Initialize postprocessing controller. */ -GLOBAL void +GLOBAL(void) jinit_d_post_controller (j_decompress_ptr cinfo, boolean need_full_buffer) { my_post_ptr post; diff --git a/jdsample.c b/jdsample.c index 661e198..80ffefb 100644 --- a/jdsample.c +++ b/jdsample.c @@ -1,7 +1,7 @@ /* * jdsample.c * - * Copyright (C) 1991-1994, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -65,7 +65,7 @@ typedef my_upsampler * my_upsample_ptr; * Initialize for an upsampling pass. */ -METHODDEF void +METHODDEF(void) start_pass_upsample (j_decompress_ptr cinfo) { my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; @@ -85,7 +85,7 @@ start_pass_upsample (j_decompress_ptr cinfo) * color conversion a row at a time. */ -METHODDEF void +METHODDEF(void) sep_upsample (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, @@ -153,7 +153,7 @@ sep_upsample (j_decompress_ptr cinfo, * "consumed" until we are done color converting and emitting it. */ -METHODDEF void +METHODDEF(void) fullsize_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { @@ -166,7 +166,7 @@ fullsize_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, * These components will not be referenced by color conversion. */ -METHODDEF void +METHODDEF(void) noop_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { @@ -185,7 +185,7 @@ noop_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, * you would be well advised to improve this code. */ -METHODDEF void +METHODDEF(void) int_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { @@ -229,7 +229,7 @@ int_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, * It's still a box filter. */ -METHODDEF void +METHODDEF(void) h2v1_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { @@ -257,7 +257,7 @@ h2v1_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, * It's still a box filter. */ -METHODDEF void +METHODDEF(void) h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { @@ -300,7 +300,7 @@ h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, * alternate pixel locations (a simple ordered dither pattern). */ -METHODDEF void +METHODDEF(void) h2v1_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { @@ -341,7 +341,7 @@ h2v1_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, * context from the main buffer controller (see initialization code). */ -METHODDEF void +METHODDEF(void) h2v2_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { @@ -395,7 +395,7 @@ h2v2_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, * Module initialization routine for upsampling. */ -GLOBAL void +GLOBAL(void) jinit_upsampler (j_decompress_ptr cinfo) { my_upsample_ptr upsample; diff --git a/jdtrans.c b/jdtrans.c index 5c14adc..db620bc 100644 --- a/jdtrans.c +++ b/jdtrans.c @@ -1,7 +1,7 @@ /* * jdtrans.c * - * Copyright (C) 1995, Thomas G. Lane. + * Copyright (C) 1995-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -16,7 +16,7 @@ /* Forward declarations */ -LOCAL void transdecode_master_selection JPP((j_decompress_ptr cinfo)); +LOCAL(void) transdecode_master_selection JPP((j_decompress_ptr cinfo)); /* @@ -34,7 +34,7 @@ LOCAL void transdecode_master_selection JPP((j_decompress_ptr cinfo)); * a suspending data source is used. */ -GLOBAL jvirt_barray_ptr * +GLOBAL(jvirt_barray_ptr *) jpeg_read_coefficients (j_decompress_ptr cinfo) { if (cinfo->global_state == DSTATE_READY) { @@ -75,7 +75,7 @@ jpeg_read_coefficients (j_decompress_ptr cinfo) * This substitutes for jdmaster.c's initialization of the full decompressor. */ -LOCAL void +LOCAL(void) transdecode_master_selection (j_decompress_ptr cinfo) { /* Entropy decoding: either Huffman or arithmetic coding. */ diff --git a/jerror.c b/jerror.c index e479fc3..8b89e39 100644 --- a/jerror.c +++ b/jerror.c @@ -1,7 +1,7 @@ /* * jerror.c * - * Copyright (C) 1991-1994, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -57,7 +57,7 @@ const char * const jpeg_std_message_table[] = { * or jpeg_destroy) at some point. */ -METHODDEF void +METHODDEF(void) error_exit (j_common_ptr cinfo) { /* Always display the message */ @@ -76,7 +76,7 @@ error_exit (j_common_ptr cinfo) * other than stderr. */ -METHODDEF void +METHODDEF(void) output_message (j_common_ptr cinfo) { char buffer[JMSG_LENGTH_MAX]; @@ -100,7 +100,7 @@ output_message (j_common_ptr cinfo) * or change the policy about which messages to display. */ -METHODDEF void +METHODDEF(void) emit_message (j_common_ptr cinfo, int msg_level) { struct jpeg_error_mgr * err = cinfo->err; @@ -129,7 +129,7 @@ emit_message (j_common_ptr cinfo, int msg_level) * Few applications should need to override this method. */ -METHODDEF void +METHODDEF(void) format_message (j_common_ptr cinfo, char * buffer) { struct jpeg_error_mgr * err = cinfo->err; @@ -184,7 +184,7 @@ format_message (j_common_ptr cinfo, char * buffer) * this method if it has additional error processing state. */ -METHODDEF void +METHODDEF(void) reset_error_mgr (j_common_ptr cinfo) { cinfo->err->num_warnings = 0; @@ -203,7 +203,7 @@ reset_error_mgr (j_common_ptr cinfo) * after which the application may override some of the methods. */ -GLOBAL struct jpeg_error_mgr * +GLOBAL(struct jpeg_error_mgr *) jpeg_std_error (struct jpeg_error_mgr * err) { err->error_exit = error_exit; diff --git a/jerror.h b/jerror.h index bf60e7e..de82c8a 100644 --- a/jerror.h +++ b/jerror.h @@ -49,6 +49,8 @@ JMESSAGE(JERR_BAD_DCTSIZE, "IDCT output block size %d not supported") JMESSAGE(JERR_BAD_IN_COLORSPACE, "Bogus input colorspace") JMESSAGE(JERR_BAD_J_COLORSPACE, "Bogus JPEG colorspace") JMESSAGE(JERR_BAD_LENGTH, "Bogus marker length") +JMESSAGE(JERR_BAD_LIB_VERSION, + "Wrong JPEG library version: library is %d, caller expects %d") JMESSAGE(JERR_BAD_MCU_SIZE, "Sampling factors too large for interleaved scan") JMESSAGE(JERR_BAD_POOL_ID, "Invalid memory pool code %d") JMESSAGE(JERR_BAD_PRECISION, "Unsupported JPEG data precision %d") @@ -59,6 +61,8 @@ JMESSAGE(JERR_BAD_PROG_SCRIPT, JMESSAGE(JERR_BAD_SAMPLING, "Bogus sampling factors") JMESSAGE(JERR_BAD_SCAN_SCRIPT, "Invalid scan script at entry %d") JMESSAGE(JERR_BAD_STATE, "Improper call to JPEG library in state %d") +JMESSAGE(JERR_BAD_STRUCT_SIZE, + "JPEG parameter struct mismatch: library thinks size is %u, caller expects %u") JMESSAGE(JERR_BAD_VIRTUAL_ACCESS, "Bogus virtual array access") JMESSAGE(JERR_BUFFER_SIZE, "Buffer passed to JPEG library is too small") JMESSAGE(JERR_CANT_SUSPEND, "Suspension not allowed here") diff --git a/jfdctflt.c b/jfdctflt.c index 21371eb..79d7a00 100644 --- a/jfdctflt.c +++ b/jfdctflt.c @@ -1,7 +1,7 @@ /* * jfdctflt.c * - * Copyright (C) 1994, Thomas G. Lane. + * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -55,7 +55,7 @@ * Perform the forward DCT on one block of samples. */ -GLOBAL void +GLOBAL(void) jpeg_fdct_float (FAST_FLOAT * data) { FAST_FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; diff --git a/jfdctfst.c b/jfdctfst.c index a52d7b7..ccb378a 100644 --- a/jfdctfst.c +++ b/jfdctfst.c @@ -1,7 +1,7 @@ /* * jfdctfst.c * - * Copyright (C) 1994, Thomas G. Lane. + * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -110,7 +110,7 @@ * Perform the forward DCT on one block of samples. */ -GLOBAL void +GLOBAL(void) jpeg_fdct_ifast (DCTELEM * data) { DCTELEM tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; diff --git a/jfdctint.c b/jfdctint.c index 7df0433..0a78b64 100644 --- a/jfdctint.c +++ b/jfdctint.c @@ -1,7 +1,7 @@ /* * jfdctint.c * - * Copyright (C) 1991-1994, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -136,7 +136,7 @@ * Perform the forward DCT on one block of samples. */ -GLOBAL void +GLOBAL(void) jpeg_fdct_islow (DCTELEM * data) { INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; diff --git a/jidctflt.c b/jidctflt.c index 847919e..1724a0b 100644 --- a/jidctflt.c +++ b/jidctflt.c @@ -1,7 +1,7 @@ /* * jidctflt.c * - * Copyright (C) 1994, Thomas G. Lane. + * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -64,7 +64,7 @@ * Perform dequantization and inverse DCT on one block of coefficients. */ -GLOBAL void +GLOBAL(void) jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) diff --git a/jidctfst.c b/jidctfst.c index 5736817..c8661ba 100644 --- a/jidctfst.c +++ b/jidctfst.c @@ -1,7 +1,7 @@ /* * jidctfst.c * - * Copyright (C) 1994-1995, Thomas G. Lane. + * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -164,7 +164,7 @@ * Perform dequantization and inverse DCT on one block of coefficients. */ -GLOBAL void +GLOBAL(void) jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) diff --git a/jidctint.c b/jidctint.c index f25b08d..002dac2 100644 --- a/jidctint.c +++ b/jidctint.c @@ -1,7 +1,7 @@ /* * jidctint.c * - * Copyright (C) 1991-1994, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -144,7 +144,7 @@ * Perform dequantization and inverse DCT on one block of coefficients. */ -GLOBAL void +GLOBAL(void) jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) diff --git a/jidctred.c b/jidctred.c index 019c339..3ec649c 100644 --- a/jidctred.c +++ b/jidctred.c @@ -1,7 +1,7 @@ /* * jidctred.c * - * Copyright (C) 1994, Thomas G. Lane. + * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -114,7 +114,7 @@ * producing a reduced-size 4x4 output block. */ -GLOBAL void +GLOBAL(void) jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) @@ -266,7 +266,7 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, * producing a reduced-size 2x2 output block. */ -GLOBAL void +GLOBAL(void) jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) @@ -374,7 +374,7 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, * producing a reduced-size 1x1 output block. */ -GLOBAL void +GLOBAL(void) jpeg_idct_1x1 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) diff --git a/jmemansi.c b/jmemansi.c index 70010f9..2d93e49 100644 --- a/jmemansi.c +++ b/jmemansi.c @@ -1,7 +1,7 @@ /* * jmemansi.c * - * Copyright (C) 1992-1994, Thomas G. Lane. + * Copyright (C) 1992-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -32,13 +32,13 @@ extern void free JPP((void *ptr)); * routines malloc() and free(). */ -GLOBAL void * +GLOBAL(void *) jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject) { return (void *) malloc(sizeofobject); } -GLOBAL void +GLOBAL(void) jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) { free(object); @@ -52,13 +52,13 @@ jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) * you probably won't be able to process useful-size images in only 64KB. */ -GLOBAL void FAR * +GLOBAL(void FAR *) jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject) { return (void FAR *) malloc(sizeofobject); } -GLOBAL void +GLOBAL(void) jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) { free(object); @@ -77,7 +77,7 @@ jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) #define DEFAULT_MAX_MEM 1000000L /* default: one megabyte */ #endif -GLOBAL long +GLOBAL(long) jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, long max_bytes_needed, long already_allocated) { @@ -93,7 +93,7 @@ jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, */ -METHODDEF void +METHODDEF(void) read_backing_store (j_common_ptr cinfo, backing_store_ptr info, void FAR * buffer_address, long file_offset, long byte_count) @@ -106,7 +106,7 @@ read_backing_store (j_common_ptr cinfo, backing_store_ptr info, } -METHODDEF void +METHODDEF(void) write_backing_store (j_common_ptr cinfo, backing_store_ptr info, void FAR * buffer_address, long file_offset, long byte_count) @@ -119,7 +119,7 @@ write_backing_store (j_common_ptr cinfo, backing_store_ptr info, } -METHODDEF void +METHODDEF(void) close_backing_store (j_common_ptr cinfo, backing_store_ptr info) { fclose(info->temp_file); @@ -137,7 +137,7 @@ close_backing_store (j_common_ptr cinfo, backing_store_ptr info) * indeed, we can't even find out the actual name of the temp file. */ -GLOBAL void +GLOBAL(void) jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, long total_bytes_needed) { @@ -154,13 +154,13 @@ jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, * cleanup required. */ -GLOBAL long +GLOBAL(long) jpeg_mem_init (j_common_ptr cinfo) { return DEFAULT_MAX_MEM; /* default for max_memory_to_use */ } -GLOBAL void +GLOBAL(void) jpeg_mem_term (j_common_ptr cinfo) { /* no work */ diff --git a/jmemdos.c b/jmemdos.c index 4db8ec5..77fb5ad 100644 --- a/jmemdos.c +++ b/jmemdos.c @@ -1,7 +1,7 @@ /* * jmemdos.c * - * Copyright (C) 1992-1994, Thomas G. Lane. + * Copyright (C) 1992-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -85,7 +85,7 @@ extern char * getenv JPP((const char * name)); /* * Declarations for assembly-language support routines (see jmemdosa.asm). * - * The functions are declared "far" as are all pointer arguments; + * The functions are declared "far" as are all their pointer arguments; * this ensures the assembly source code will work regardless of the * compiler memory model. We assume "short" is 16 bits, "long" is 32. */ @@ -100,17 +100,17 @@ typedef struct { /* registers for calling EMS driver */ void far * ds_si; } EMScontext; -EXTERN short far jdos_open JPP((short far * handle, char far * filename)); -EXTERN short far jdos_close JPP((short handle)); -EXTERN short far jdos_seek JPP((short handle, long offset)); -EXTERN short far jdos_read JPP((short handle, void far * buffer, +extern short far jdos_open JPP((short far * handle, char far * filename)); +extern short far jdos_close JPP((short handle)); +extern short far jdos_seek JPP((short handle, long offset)); +extern short far jdos_read JPP((short handle, void far * buffer, unsigned short count)); -EXTERN short far jdos_write JPP((short handle, void far * buffer, +extern short far jdos_write JPP((short handle, void far * buffer, unsigned short count)); -EXTERN void far jxms_getdriver JPP((XMSDRIVER far *)); -EXTERN void far jxms_calldriver JPP((XMSDRIVER, XMScontext far *)); -EXTERN short far jems_available JPP((void)); -EXTERN void far jems_calldriver JPP((EMScontext far *)); +extern void far jxms_getdriver JPP((XMSDRIVER far *)); +extern void far jxms_calldriver JPP((XMSDRIVER, XMScontext far *)); +extern short far jems_available JPP((void)); +extern void far jems_calldriver JPP((EMScontext far *)); /* @@ -120,7 +120,7 @@ EXTERN void far jems_calldriver JPP((EMScontext far *)); static int next_file_num; /* to distinguish among several temp files */ -LOCAL void +LOCAL(void) select_file_name (char * fname) { const char * env; @@ -158,13 +158,13 @@ select_file_name (char * fname) * routines malloc() and free(). */ -GLOBAL void * +GLOBAL(void *) jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject) { return (void *) malloc(sizeofobject); } -GLOBAL void +GLOBAL(void) jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) { free(object); @@ -175,13 +175,13 @@ jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) * "Large" objects are allocated in far memory, if possible */ -GLOBAL void FAR * +GLOBAL(void FAR *) jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject) { return (void FAR *) far_malloc(sizeofobject); } -GLOBAL void +GLOBAL(void) jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) { far_free(object); @@ -200,7 +200,7 @@ jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) #define DEFAULT_MAX_MEM 300000L /* for total usage about 450K */ #endif -GLOBAL long +GLOBAL(long) jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, long max_bytes_needed, long already_allocated) { @@ -235,7 +235,7 @@ jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, */ -METHODDEF void +METHODDEF(void) read_file_store (j_common_ptr cinfo, backing_store_ptr info, void FAR * buffer_address, long file_offset, long byte_count) @@ -251,7 +251,7 @@ read_file_store (j_common_ptr cinfo, backing_store_ptr info, } -METHODDEF void +METHODDEF(void) write_file_store (j_common_ptr cinfo, backing_store_ptr info, void FAR * buffer_address, long file_offset, long byte_count) @@ -267,7 +267,7 @@ write_file_store (j_common_ptr cinfo, backing_store_ptr info, } -METHODDEF void +METHODDEF(void) close_file_store (j_common_ptr cinfo, backing_store_ptr info) { jdos_close(info->handle.file_handle); /* close the file */ @@ -280,7 +280,7 @@ close_file_store (j_common_ptr cinfo, backing_store_ptr info) } -LOCAL boolean +LOCAL(boolean) open_file_store (j_common_ptr cinfo, backing_store_ptr info, long total_bytes_needed) { @@ -325,7 +325,7 @@ typedef struct { /* XMS move specification structure */ #define ODD(X) (((X) & 1L) != 0) -METHODDEF void +METHODDEF(void) read_xms_store (j_common_ptr cinfo, backing_store_ptr info, void FAR * buffer_address, long file_offset, long byte_count) @@ -358,7 +358,7 @@ read_xms_store (j_common_ptr cinfo, backing_store_ptr info, } -METHODDEF void +METHODDEF(void) write_xms_store (j_common_ptr cinfo, backing_store_ptr info, void FAR * buffer_address, long file_offset, long byte_count) @@ -393,7 +393,7 @@ write_xms_store (j_common_ptr cinfo, backing_store_ptr info, } -METHODDEF void +METHODDEF(void) close_xms_store (j_common_ptr cinfo, backing_store_ptr info) { XMScontext ctx; @@ -406,7 +406,7 @@ close_xms_store (j_common_ptr cinfo, backing_store_ptr info) } -LOCAL boolean +LOCAL(boolean) open_xms_store (j_common_ptr cinfo, backing_store_ptr info, long total_bytes_needed) { @@ -483,7 +483,7 @@ typedef union { /* EMS move specification structure */ #define LOBYTE(W) ((W) & 0xFF) -METHODDEF void +METHODDEF(void) read_ems_store (j_common_ptr cinfo, backing_store_ptr info, void FAR * buffer_address, long file_offset, long byte_count) @@ -508,7 +508,7 @@ read_ems_store (j_common_ptr cinfo, backing_store_ptr info, } -METHODDEF void +METHODDEF(void) write_ems_store (j_common_ptr cinfo, backing_store_ptr info, void FAR * buffer_address, long file_offset, long byte_count) @@ -533,7 +533,7 @@ write_ems_store (j_common_ptr cinfo, backing_store_ptr info, } -METHODDEF void +METHODDEF(void) close_ems_store (j_common_ptr cinfo, backing_store_ptr info) { EMScontext ctx; @@ -546,7 +546,7 @@ close_ems_store (j_common_ptr cinfo, backing_store_ptr info) } -LOCAL boolean +LOCAL(boolean) open_ems_store (j_common_ptr cinfo, backing_store_ptr info, long total_bytes_needed) { @@ -591,7 +591,7 @@ open_ems_store (j_common_ptr cinfo, backing_store_ptr info, * Initial opening of a backing-store object. */ -GLOBAL void +GLOBAL(void) jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, long total_bytes_needed) { @@ -615,14 +615,14 @@ jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, * cleanup required. */ -GLOBAL long +GLOBAL(long) jpeg_mem_init (j_common_ptr cinfo) { next_file_num = 0; /* initialize temp file name generator */ return DEFAULT_MAX_MEM; /* default for max_memory_to_use */ } -GLOBAL void +GLOBAL(void) jpeg_mem_term (j_common_ptr cinfo) { /* Microsoft C, at least in v6.00A, will not successfully reclaim freed diff --git a/jmemmac.c b/jmemmac.c new file mode 100644 index 0000000..41756cb --- /dev/null +++ b/jmemmac.c @@ -0,0 +1,199 @@ +/* + * jmemmac.c + * + * Copyright (C) 1992-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * jmemmac.c provides an Apple Macintosh implementation of the system- + * dependent portion of the JPEG memory manager. + * + * jmemmac.c uses the Macintosh toolbox routines NewPtr and DisposePtr + * instead of malloc and free. It accurately determines the amount of + * memory available by using CompactMem. Notice that if left to its + * own devices, this code can chew up all available space in the + * application's zone, with the exception of the rather small "slop" + * factor computed in jpeg_mem_available(). The application can ensure + * that more space is left over by reducing max_memory_to_use. + * + * Large images are swapped to disk using temporary files created with + * tmpfile(); that part of the module is the same as in jmemansi.c. + * Metrowerks CodeWarrior's implementation of tmpfile() isn't quite what + * we want: it puts the files in the local directory and makes them + * user-visible -- and only deletes them when the application quits, + * which means they stick around in the event of a crash. + * It would be better to create the temp files in the system's temporary + * items folder. Perhaps someday we'll get around to doing that. + * + * Contributed by Sam Bushell (jsam@iagu.on.net). + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" +#include "jmemsys.h" /* import the system-dependent declarations */ + +#include /* we use the MacOS memory manager */ + +#ifndef SEEK_SET /* pre-ANSI systems may not define this; */ +#define SEEK_SET 0 /* if not, assume 0 is correct */ +#endif + + +/* + * Memory allocation and freeing are controlled by the MacOS library + * routines NewPtr() and DisposePtr(), which allocate fixed-address + * storage. Unfortunately, the IJG library isn't smart enough to cope + * with relocatable storage. + */ + +GLOBAL(void *) +jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject) +{ + return (void *) NewPtr(sizeofobject); +} + +GLOBAL(void) +jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) +{ + DisposePtr((Ptr) object); +} + + +/* + * "Large" objects are treated the same as "small" ones. + * NB: we include FAR keywords in the routine declarations simply for + * consistency with the rest of the IJG code; FAR should expand to empty + * on rational architectures like the Mac. + */ + +GLOBAL(void FAR *) +jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject) +{ + return (void FAR *) NewPtr(sizeofobject); +} + +GLOBAL(void) +jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) +{ + DisposePtr((Ptr) object); +} + + +/* + * This routine computes the total memory space available for allocation. + */ + +GLOBAL(long) +jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, + long max_bytes_needed, long already_allocated) +{ + long limit = cinfo->mem->max_memory_to_use - already_allocated; + long slop, mem; + + /* Don't ask for more than what application has told us we may use */ + if (max_bytes_needed > limit && limit > 0) + max_bytes_needed = limit; + /* Find whether there's a big enough free block in the heap. + * CompactMem tries to create a contiguous block of the requested size, + * and then returns the size of the largest free block (which could be + * much more or much less than we asked for). + * We add some slop to ensure we don't use up all available memory. + */ + slop = max_bytes_needed / 16 + 32768L; + mem = CompactMem(max_bytes_needed + slop) - slop; + if (mem < 0) + mem = 0; /* sigh, couldn't even get the slop */ + /* Don't take more than the application says we can have */ + if (mem > limit && limit > 0) + mem = limit; + return mem; +} + + +/* + * Backing store (temporary file) management. + * Backing store objects are only used when the value returned by + * jpeg_mem_available is less than the total space needed. You can dispense + * with these routines if you have plenty of virtual memory; see jmemnobs.c. + */ + + +METHODDEF(void) +read_backing_store (j_common_ptr cinfo, backing_store_ptr info, + void FAR * buffer_address, + long file_offset, long byte_count) +{ + if (fseek(info->temp_file, file_offset, SEEK_SET)) + ERREXIT(cinfo, JERR_TFILE_SEEK); + if (JFREAD(info->temp_file, buffer_address, byte_count) + != (size_t) byte_count) + ERREXIT(cinfo, JERR_TFILE_READ); +} + + +METHODDEF(void) +write_backing_store (j_common_ptr cinfo, backing_store_ptr info, + void FAR * buffer_address, + long file_offset, long byte_count) +{ + if (fseek(info->temp_file, file_offset, SEEK_SET)) + ERREXIT(cinfo, JERR_TFILE_SEEK); + if (JFWRITE(info->temp_file, buffer_address, byte_count) + != (size_t) byte_count) + ERREXIT(cinfo, JERR_TFILE_WRITE); +} + + +METHODDEF(void) +close_backing_store (j_common_ptr cinfo, backing_store_ptr info) +{ + fclose(info->temp_file); + /* Since this implementation uses tmpfile() to create the file, + * no explicit file deletion is needed. + */ +} + + +/* + * Initial opening of a backing-store object. + * + * This version uses tmpfile(), which constructs a suitable file name + * behind the scenes. We don't have to use info->temp_name[] at all; + * indeed, we can't even find out the actual name of the temp file. + */ + +GLOBAL(void) +jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, + long total_bytes_needed) +{ + if ((info->temp_file = tmpfile()) == NULL) + ERREXITS(cinfo, JERR_TFILE_CREATE, ""); + info->read_backing_store = read_backing_store; + info->write_backing_store = write_backing_store; + info->close_backing_store = close_backing_store; +} + + +/* + * These routines take care of any system-dependent initialization and + * cleanup required. + */ + +GLOBAL(long) +jpeg_mem_init (j_common_ptr cinfo) +{ + /* max_memory_to_use will be initialized to FreeMem()'s result; + * the calling application might later reduce it, for example + * to leave room to invoke multiple JPEG objects. + * Note that FreeMem returns the total number of free bytes; + * it may not be possible to allocate a single block of this size. + */ + return FreeMem(); +} + +GLOBAL(void) +jpeg_mem_term (j_common_ptr cinfo) +{ + /* no work */ +} diff --git a/jmemmgr.c b/jmemmgr.c index dc3e1c7..5ea19ce 100644 --- a/jmemmgr.c +++ b/jmemmgr.c @@ -1,7 +1,7 @@ /* * jmemmgr.c * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -182,7 +182,7 @@ struct jvirt_barray_control { #ifdef MEM_STATS /* optional extra stuff for statistics */ -LOCAL void +LOCAL(void) print_mem_stats (j_common_ptr cinfo, int pool_id) { my_mem_ptr mem = (my_mem_ptr) cinfo->mem; @@ -213,7 +213,7 @@ print_mem_stats (j_common_ptr cinfo, int pool_id) #endif /* MEM_STATS */ -LOCAL void +LOCAL(void) out_of_memory (j_common_ptr cinfo, int which) /* Report an out-of-memory error and stop execution */ /* If we compiled MEM_STATS support, report alloc requests before dying */ @@ -253,7 +253,7 @@ static const size_t extra_pool_slop[JPOOL_NUMPOOLS] = #define MIN_SLOP 50 /* greater than 0 to avoid futile looping */ -METHODDEF void * +METHODDEF(void *) alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject) /* Allocate a "small" object */ { @@ -338,7 +338,7 @@ alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject) * deliberately bunch rows together to ensure a large request size. */ -METHODDEF void FAR * +METHODDEF(void FAR *) alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject) /* Allocate a "large" object */ { @@ -391,7 +391,7 @@ alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject) * a virtual array. */ -METHODDEF JSAMPARRAY +METHODDEF(JSAMPARRAY) alloc_sarray (j_common_ptr cinfo, int pool_id, JDIMENSION samplesperrow, JDIMENSION numrows) /* Allocate a 2-D sample array */ @@ -439,7 +439,7 @@ alloc_sarray (j_common_ptr cinfo, int pool_id, * This is essentially the same as the code for sample arrays, above. */ -METHODDEF JBLOCKARRAY +METHODDEF(JBLOCKARRAY) alloc_barray (j_common_ptr cinfo, int pool_id, JDIMENSION blocksperrow, JDIMENSION numrows) /* Allocate a 2-D coefficient-block array */ @@ -519,7 +519,7 @@ alloc_barray (j_common_ptr cinfo, int pool_id, */ -METHODDEF jvirt_sarray_ptr +METHODDEF(jvirt_sarray_ptr) request_virt_sarray (j_common_ptr cinfo, int pool_id, boolean pre_zero, JDIMENSION samplesperrow, JDIMENSION numrows, JDIMENSION maxaccess) @@ -549,7 +549,7 @@ request_virt_sarray (j_common_ptr cinfo, int pool_id, boolean pre_zero, } -METHODDEF jvirt_barray_ptr +METHODDEF(jvirt_barray_ptr) request_virt_barray (j_common_ptr cinfo, int pool_id, boolean pre_zero, JDIMENSION blocksperrow, JDIMENSION numrows, JDIMENSION maxaccess) @@ -579,7 +579,7 @@ request_virt_barray (j_common_ptr cinfo, int pool_id, boolean pre_zero, } -METHODDEF void +METHODDEF(void) realize_virt_arrays (j_common_ptr cinfo) /* Allocate the in-memory buffers for any unrealized virtual arrays */ { @@ -686,7 +686,7 @@ realize_virt_arrays (j_common_ptr cinfo) } -LOCAL void +LOCAL(void) do_sarray_io (j_common_ptr cinfo, jvirt_sarray_ptr ptr, boolean writing) /* Do backing store read or write of a virtual sample array */ { @@ -719,7 +719,7 @@ do_sarray_io (j_common_ptr cinfo, jvirt_sarray_ptr ptr, boolean writing) } -LOCAL void +LOCAL(void) do_barray_io (j_common_ptr cinfo, jvirt_barray_ptr ptr, boolean writing) /* Do backing store read or write of a virtual coefficient-block array */ { @@ -752,7 +752,7 @@ do_barray_io (j_common_ptr cinfo, jvirt_barray_ptr ptr, boolean writing) } -METHODDEF JSAMPARRAY +METHODDEF(JSAMPARRAY) access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr, JDIMENSION start_row, JDIMENSION num_rows, boolean writable) @@ -837,7 +837,7 @@ access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr, } -METHODDEF JBLOCKARRAY +METHODDEF(JBLOCKARRAY) access_virt_barray (j_common_ptr cinfo, jvirt_barray_ptr ptr, JDIMENSION start_row, JDIMENSION num_rows, boolean writable) @@ -926,7 +926,7 @@ access_virt_barray (j_common_ptr cinfo, jvirt_barray_ptr ptr, * Release all objects belonging to a specified pool. */ -METHODDEF void +METHODDEF(void) free_pool (j_common_ptr cinfo, int pool_id) { my_mem_ptr mem = (my_mem_ptr) cinfo->mem; @@ -998,7 +998,7 @@ free_pool (j_common_ptr cinfo, int pool_id) * Note that this cannot be called unless cinfo->mem is non-NULL. */ -METHODDEF void +METHODDEF(void) self_destruct (j_common_ptr cinfo) { int pool; @@ -1024,7 +1024,7 @@ self_destruct (j_common_ptr cinfo) * When this is called, only the error manager pointer is valid in cinfo! */ -GLOBAL void +GLOBAL(void) jinit_memory_mgr (j_common_ptr cinfo) { my_mem_ptr mem; diff --git a/jmemname.c b/jmemname.c index ba826fb..d1b57e9 100644 --- a/jmemname.c +++ b/jmemname.c @@ -1,7 +1,7 @@ /* * jmemname.c * - * Copyright (C) 1992-1994, Thomas G. Lane. + * Copyright (C) 1992-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -86,7 +86,7 @@ extern int errno; #endif -LOCAL void +LOCAL(void) select_file_name (char * fname) { FILE * tfile; @@ -117,7 +117,7 @@ select_file_name (char * fname) #define TEMP_FILE_NAME "%sJPG%dXXXXXX" #endif -LOCAL void +LOCAL(void) select_file_name (char * fname) { next_file_num++; /* advance counter */ @@ -134,13 +134,13 @@ select_file_name (char * fname) * routines malloc() and free(). */ -GLOBAL void * +GLOBAL(void *) jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject) { return (void *) malloc(sizeofobject); } -GLOBAL void +GLOBAL(void) jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) { free(object); @@ -154,13 +154,13 @@ jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) * you probably won't be able to process useful-size images in only 64KB. */ -GLOBAL void FAR * +GLOBAL(void FAR *) jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject) { return (void FAR *) malloc(sizeofobject); } -GLOBAL void +GLOBAL(void) jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) { free(object); @@ -179,7 +179,7 @@ jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) #define DEFAULT_MAX_MEM 1000000L /* default: one megabyte */ #endif -GLOBAL long +GLOBAL(long) jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, long max_bytes_needed, long already_allocated) { @@ -195,7 +195,7 @@ jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, */ -METHODDEF void +METHODDEF(void) read_backing_store (j_common_ptr cinfo, backing_store_ptr info, void FAR * buffer_address, long file_offset, long byte_count) @@ -208,7 +208,7 @@ read_backing_store (j_common_ptr cinfo, backing_store_ptr info, } -METHODDEF void +METHODDEF(void) write_backing_store (j_common_ptr cinfo, backing_store_ptr info, void FAR * buffer_address, long file_offset, long byte_count) @@ -221,7 +221,7 @@ write_backing_store (j_common_ptr cinfo, backing_store_ptr info, } -METHODDEF void +METHODDEF(void) close_backing_store (j_common_ptr cinfo, backing_store_ptr info) { fclose(info->temp_file); /* close the file */ @@ -238,7 +238,7 @@ close_backing_store (j_common_ptr cinfo, backing_store_ptr info) * Initial opening of a backing-store object. */ -GLOBAL void +GLOBAL(void) jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, long total_bytes_needed) { @@ -257,14 +257,14 @@ jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, * cleanup required. */ -GLOBAL long +GLOBAL(long) jpeg_mem_init (j_common_ptr cinfo) { next_file_num = 0; /* initialize temp file name generator */ return DEFAULT_MAX_MEM; /* default for max_memory_to_use */ } -GLOBAL void +GLOBAL(void) jpeg_mem_term (j_common_ptr cinfo) { /* no work */ diff --git a/jmemnobs.c b/jmemnobs.c index d758f40..eb8c337 100644 --- a/jmemnobs.c +++ b/jmemnobs.c @@ -1,7 +1,7 @@ /* * jmemnobs.c * - * Copyright (C) 1992-1994, Thomas G. Lane. + * Copyright (C) 1992-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -31,13 +31,13 @@ extern void free JPP((void *ptr)); * routines malloc() and free(). */ -GLOBAL void * +GLOBAL(void *) jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject) { return (void *) malloc(sizeofobject); } -GLOBAL void +GLOBAL(void) jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) { free(object); @@ -51,13 +51,13 @@ jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) * you probably won't be able to process useful-size images in only 64KB. */ -GLOBAL void FAR * +GLOBAL(void FAR *) jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject) { return (void FAR *) malloc(sizeofobject); } -GLOBAL void +GLOBAL(void) jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) { free(object); @@ -69,7 +69,7 @@ jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) * Here we always say, "we got all you want bud!" */ -GLOBAL long +GLOBAL(long) jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, long max_bytes_needed, long already_allocated) { @@ -83,7 +83,7 @@ jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, * this should never be called and we can just error out. */ -GLOBAL void +GLOBAL(void) jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, long total_bytes_needed) { @@ -96,13 +96,13 @@ jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, * cleanup required. Here, there isn't any. */ -GLOBAL long +GLOBAL(long) jpeg_mem_init (j_common_ptr cinfo) { return 0; /* just set max_memory_to_use to 0 */ } -GLOBAL void +GLOBAL(void) jpeg_mem_term (j_common_ptr cinfo) { /* no work */ diff --git a/jmemsys.h b/jmemsys.h index 033d29a..6d4c7f2 100644 --- a/jmemsys.h +++ b/jmemsys.h @@ -1,7 +1,7 @@ /* * jmemsys.h * - * Copyright (C) 1992-1994, Thomas G. Lane. + * Copyright (C) 1992-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -43,9 +43,9 @@ * On an 80x86 machine using small-data memory model, these manage near heap. */ -EXTERN void * jpeg_get_small JPP((j_common_ptr cinfo, size_t sizeofobject)); -EXTERN void jpeg_free_small JPP((j_common_ptr cinfo, void * object, - size_t sizeofobject)); +EXTERN(void *) jpeg_get_small JPP((j_common_ptr cinfo, size_t sizeofobject)); +EXTERN(void) jpeg_free_small JPP((j_common_ptr cinfo, void * object, + size_t sizeofobject)); /* * These two functions are used to allocate and release large chunks of @@ -56,9 +56,10 @@ EXTERN void jpeg_free_small JPP((j_common_ptr cinfo, void * object, * in case a different allocation strategy is desirable for large chunks. */ -EXTERN void FAR * jpeg_get_large JPP((j_common_ptr cinfo,size_t sizeofobject)); -EXTERN void jpeg_free_large JPP((j_common_ptr cinfo, void FAR * object, - size_t sizeofobject)); +EXTERN(void FAR *) jpeg_get_large JPP((j_common_ptr cinfo, + size_t sizeofobject)); +EXTERN(void) jpeg_free_large JPP((j_common_ptr cinfo, void FAR * object, + size_t sizeofobject)); /* * The macro MAX_ALLOC_CHUNK designates the maximum number of bytes that may @@ -98,10 +99,10 @@ EXTERN void jpeg_free_large JPP((j_common_ptr cinfo, void FAR * object, * Conversely, zero may be returned to always use the minimum amount of memory. */ -EXTERN long jpeg_mem_available JPP((j_common_ptr cinfo, - long min_bytes_needed, - long max_bytes_needed, - long already_allocated)); +EXTERN(long) jpeg_mem_available JPP((j_common_ptr cinfo, + long min_bytes_needed, + long max_bytes_needed, + long already_allocated)); /* @@ -161,9 +162,9 @@ typedef struct backing_store_struct { * just take an error exit.) */ -EXTERN void jpeg_open_backing_store JPP((j_common_ptr cinfo, - backing_store_ptr info, - long total_bytes_needed)); +EXTERN(void) jpeg_open_backing_store JPP((j_common_ptr cinfo, + backing_store_ptr info, + long total_bytes_needed)); /* @@ -178,5 +179,5 @@ EXTERN void jpeg_open_backing_store JPP((j_common_ptr cinfo, * all opened backing-store objects have been closed. */ -EXTERN long jpeg_mem_init JPP((j_common_ptr cinfo)); -EXTERN void jpeg_mem_term JPP((j_common_ptr cinfo)); +EXTERN(long) jpeg_mem_init JPP((j_common_ptr cinfo)); +EXTERN(void) jpeg_mem_term JPP((j_common_ptr cinfo)); diff --git a/jmorecfg.h b/jmorecfg.h index 5ae60cf..e43651b 100644 --- a/jmorecfg.h +++ b/jmorecfg.h @@ -1,7 +1,7 @@ /* * jmorecfg.h * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -173,16 +173,34 @@ typedef unsigned int JDIMENSION; #define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */ -/* These defines are used in all function definitions and extern declarations. - * You could modify them if you need to change function linkage conventions. +/* These macros are used in all function definitions and extern declarations. + * You could modify them if you need to change function linkage conventions; + * in particular, you'll need to do that to make the library a Windows DLL. * Another application is to make all functions global for use with debuggers * or code profilers that require it. */ -#define METHODDEF static /* a function called through method pointers */ -#define LOCAL static /* a function used only in its module */ -#define GLOBAL /* a function referenced thru EXTERNs */ -#define EXTERN extern /* a reference to a GLOBAL function */ +/* a function called through method pointers: */ +#define METHODDEF(type) static type +/* a function used only in its module: */ +#define LOCAL(type) static type +/* a function referenced thru EXTERNs: */ +#define GLOBAL(type) type +/* a reference to a GLOBAL function: */ +#define EXTERN(type) extern type + + +/* This macro is used to declare a "method", that is, a function pointer. + * We want to supply prototype parameters if the compiler can cope. + * Note that the arglist parameter must be parenthesized! + * Again, you can customize this if you need special linkage keywords. + */ + +#ifdef HAVE_PROTOTYPES +#define JMETHOD(type,methodname,arglist) type (*methodname) arglist +#else +#define JMETHOD(type,methodname,arglist) type (*methodname) () +#endif /* Here is the pseudo-keyword for declaring pointers that must be "far" diff --git a/jpegint.h b/jpegint.h index ab5bee2..7ba30c3 100644 --- a/jpegint.h +++ b/jpegint.h @@ -1,7 +1,7 @@ /* * jpegint.h * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -329,51 +329,51 @@ struct jpeg_color_quantizer { /* Compression module initialization routines */ -EXTERN void jinit_compress_master JPP((j_compress_ptr cinfo)); -EXTERN void jinit_c_master_control JPP((j_compress_ptr cinfo, - boolean transcode_only)); -EXTERN void jinit_c_main_controller JPP((j_compress_ptr cinfo, - boolean need_full_buffer)); -EXTERN void jinit_c_prep_controller JPP((j_compress_ptr cinfo, - boolean need_full_buffer)); -EXTERN void jinit_c_coef_controller JPP((j_compress_ptr cinfo, - boolean need_full_buffer)); -EXTERN void jinit_color_converter JPP((j_compress_ptr cinfo)); -EXTERN void jinit_downsampler JPP((j_compress_ptr cinfo)); -EXTERN void jinit_forward_dct JPP((j_compress_ptr cinfo)); -EXTERN void jinit_huff_encoder JPP((j_compress_ptr cinfo)); -EXTERN void jinit_phuff_encoder JPP((j_compress_ptr cinfo)); -EXTERN void jinit_marker_writer JPP((j_compress_ptr cinfo)); +EXTERN(void) jinit_compress_master JPP((j_compress_ptr cinfo)); +EXTERN(void) jinit_c_master_control JPP((j_compress_ptr cinfo, + boolean transcode_only)); +EXTERN(void) jinit_c_main_controller JPP((j_compress_ptr cinfo, + boolean need_full_buffer)); +EXTERN(void) jinit_c_prep_controller JPP((j_compress_ptr cinfo, + boolean need_full_buffer)); +EXTERN(void) jinit_c_coef_controller JPP((j_compress_ptr cinfo, + boolean need_full_buffer)); +EXTERN(void) jinit_color_converter JPP((j_compress_ptr cinfo)); +EXTERN(void) jinit_downsampler JPP((j_compress_ptr cinfo)); +EXTERN(void) jinit_forward_dct JPP((j_compress_ptr cinfo)); +EXTERN(void) jinit_huff_encoder JPP((j_compress_ptr cinfo)); +EXTERN(void) jinit_phuff_encoder JPP((j_compress_ptr cinfo)); +EXTERN(void) jinit_marker_writer JPP((j_compress_ptr cinfo)); /* Decompression module initialization routines */ -EXTERN void jinit_master_decompress JPP((j_decompress_ptr cinfo)); -EXTERN void jinit_d_main_controller JPP((j_decompress_ptr cinfo, - boolean need_full_buffer)); -EXTERN void jinit_d_coef_controller JPP((j_decompress_ptr cinfo, - boolean need_full_buffer)); -EXTERN void jinit_d_post_controller JPP((j_decompress_ptr cinfo, - boolean need_full_buffer)); -EXTERN void jinit_input_controller JPP((j_decompress_ptr cinfo)); -EXTERN void jinit_marker_reader JPP((j_decompress_ptr cinfo)); -EXTERN void jinit_huff_decoder JPP((j_decompress_ptr cinfo)); -EXTERN void jinit_phuff_decoder JPP((j_decompress_ptr cinfo)); -EXTERN void jinit_inverse_dct JPP((j_decompress_ptr cinfo)); -EXTERN void jinit_upsampler JPP((j_decompress_ptr cinfo)); -EXTERN void jinit_color_deconverter JPP((j_decompress_ptr cinfo)); -EXTERN void jinit_1pass_quantizer JPP((j_decompress_ptr cinfo)); -EXTERN void jinit_2pass_quantizer JPP((j_decompress_ptr cinfo)); -EXTERN void jinit_merged_upsampler JPP((j_decompress_ptr cinfo)); +EXTERN(void) jinit_master_decompress JPP((j_decompress_ptr cinfo)); +EXTERN(void) jinit_d_main_controller JPP((j_decompress_ptr cinfo, + boolean need_full_buffer)); +EXTERN(void) jinit_d_coef_controller JPP((j_decompress_ptr cinfo, + boolean need_full_buffer)); +EXTERN(void) jinit_d_post_controller JPP((j_decompress_ptr cinfo, + boolean need_full_buffer)); +EXTERN(void) jinit_input_controller JPP((j_decompress_ptr cinfo)); +EXTERN(void) jinit_marker_reader JPP((j_decompress_ptr cinfo)); +EXTERN(void) jinit_huff_decoder JPP((j_decompress_ptr cinfo)); +EXTERN(void) jinit_phuff_decoder JPP((j_decompress_ptr cinfo)); +EXTERN(void) jinit_inverse_dct JPP((j_decompress_ptr cinfo)); +EXTERN(void) jinit_upsampler JPP((j_decompress_ptr cinfo)); +EXTERN(void) jinit_color_deconverter JPP((j_decompress_ptr cinfo)); +EXTERN(void) jinit_1pass_quantizer JPP((j_decompress_ptr cinfo)); +EXTERN(void) jinit_2pass_quantizer JPP((j_decompress_ptr cinfo)); +EXTERN(void) jinit_merged_upsampler JPP((j_decompress_ptr cinfo)); /* Memory manager initialization */ -EXTERN void jinit_memory_mgr JPP((j_common_ptr cinfo)); +EXTERN(void) jinit_memory_mgr JPP((j_common_ptr cinfo)); /* Utility routines in jutils.c */ -EXTERN long jdiv_round_up JPP((long a, long b)); -EXTERN long jround_up JPP((long a, long b)); -EXTERN void jcopy_sample_rows JPP((JSAMPARRAY input_array, int source_row, - JSAMPARRAY output_array, int dest_row, - int num_rows, JDIMENSION num_cols)); -EXTERN void jcopy_block_row JPP((JBLOCKROW input_row, JBLOCKROW output_row, - JDIMENSION num_blocks)); -EXTERN void jzero_far JPP((void FAR * target, size_t bytestozero)); +EXTERN(long) jdiv_round_up JPP((long a, long b)); +EXTERN(long) jround_up JPP((long a, long b)); +EXTERN(void) jcopy_sample_rows JPP((JSAMPARRAY input_array, int source_row, + JSAMPARRAY output_array, int dest_row, + int num_rows, JDIMENSION num_cols)); +EXTERN(void) jcopy_block_row JPP((JBLOCKROW input_row, JBLOCKROW output_row, + JDIMENSION num_blocks)); +EXTERN(void) jzero_far JPP((void FAR * target, size_t bytestozero)); /* Constant tables in jutils.c */ extern const int jpeg_zigzag_order[]; /* natural coef order to zigzag order */ extern const int jpeg_natural_order[]; /* zigzag coef order to natural order */ diff --git a/jpeglib.h b/jpeglib.h index c702fd5..b778e2d 100644 --- a/jpeglib.h +++ b/jpeglib.h @@ -1,7 +1,7 @@ /* * jpeglib.h * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -30,7 +30,7 @@ * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60". */ -#define JPEG_LIB_VERSION 60 /* Version 6 */ +#define JPEG_LIB_VERSION 61 /* Version 6a */ /* Various constants determining the sizes of things. @@ -58,18 +58,6 @@ #endif -/* This macro is used to declare a "method", that is, a function pointer. - * We want to supply prototype parameters if the compiler can cope. - * Note that the arglist parameter must be parenthesized! - */ - -#ifdef HAVE_PROTOTYPES -#define JMETHOD(type,methodname,arglist) type (*methodname) arglist -#else -#define JMETHOD(type,methodname,arglist) type (*methodname) () -#endif - - /* Data structures for images (arrays of samples and of DCT coefficients). * On 80x86 machines, the image arrays are too big for near pointers, * but the pointer arrays can fit in near memory. @@ -93,8 +81,9 @@ typedef JCOEF FAR *JCOEFPTR; /* useful in a couple of places */ /* DCT coefficient quantization tables. */ typedef struct { - /* This field directly represents the contents of a JPEG DQT marker. - * Note: the values are always given in zigzag order. + /* This array gives the coefficient quantizers in natural array order + * (not the zigzag order in which they are stored in a JPEG DQT marker). + * CAUTION: IJG versions prior to v6a kept this array in zigzag order. */ UINT16 quantval[DCTSIZE2]; /* quantization step for each coefficient */ /* This field is used only during compression. It's initialized FALSE when @@ -181,7 +170,7 @@ typedef struct { /* Saved quantization table for component; NULL if none yet saved. * See jdinput.c comments about the need for this information. - * This field is not currently used by the compressor. + * This field is currently used only for decompression. */ JQUANT_TBL * quant_table; @@ -813,8 +802,8 @@ typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo)); #ifdef NEED_SHORT_EXTERNAL_NAMES #define jpeg_std_error jStdError -#define jpeg_create_compress jCreaCompress -#define jpeg_create_decompress jCreaDecompress +#define jpeg_CreateCompress jCreaCompress +#define jpeg_CreateDecompress jCreaDecompress #define jpeg_destroy_compress jDestCompress #define jpeg_destroy_decompress jDestDecompress #define jpeg_stdio_dest jStdDest @@ -861,65 +850,81 @@ typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo)); /* Default error-management setup */ -EXTERN struct jpeg_error_mgr *jpeg_std_error JPP((struct jpeg_error_mgr *err)); +EXTERN(struct jpeg_error_mgr *) jpeg_std_error + JPP((struct jpeg_error_mgr * err)); -/* Initialization and destruction of JPEG compression objects */ -/* NB: you must set up the error-manager BEFORE calling jpeg_create_xxx */ -EXTERN void jpeg_create_compress JPP((j_compress_ptr cinfo)); -EXTERN void jpeg_create_decompress JPP((j_decompress_ptr cinfo)); -EXTERN void jpeg_destroy_compress JPP((j_compress_ptr cinfo)); -EXTERN void jpeg_destroy_decompress JPP((j_decompress_ptr cinfo)); +/* Initialization of JPEG compression objects. + * jpeg_create_compress() and jpeg_create_decompress() are the exported + * names that applications should call. These expand to calls on + * jpeg_CreateCompress and jpeg_CreateDecompress with additional information + * passed for version mismatch checking. + * NB: you must set up the error-manager BEFORE calling jpeg_create_xxx. + */ +#define jpeg_create_compress(cinfo) \ + jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \ + (size_t) sizeof(struct jpeg_compress_struct)) +#define jpeg_create_decompress(cinfo) \ + jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \ + (size_t) sizeof(struct jpeg_decompress_struct)) +EXTERN(void) jpeg_CreateCompress JPP((j_compress_ptr cinfo, + int version, size_t structsize)); +EXTERN(void) jpeg_CreateDecompress JPP((j_decompress_ptr cinfo, + int version, size_t structsize)); +/* Destruction of JPEG compression objects */ +EXTERN(void) jpeg_destroy_compress JPP((j_compress_ptr cinfo)); +EXTERN(void) jpeg_destroy_decompress JPP((j_decompress_ptr cinfo)); /* Standard data source and destination managers: stdio streams. */ /* Caller is responsible for opening the file before and closing after. */ -EXTERN void jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile)); -EXTERN void jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile)); +EXTERN(void) jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile)); +EXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile)); /* Default parameter setup for compression */ -EXTERN void jpeg_set_defaults JPP((j_compress_ptr cinfo)); +EXTERN(void) jpeg_set_defaults JPP((j_compress_ptr cinfo)); /* Compression parameter setup aids */ -EXTERN void jpeg_set_colorspace JPP((j_compress_ptr cinfo, - J_COLOR_SPACE colorspace)); -EXTERN void jpeg_default_colorspace JPP((j_compress_ptr cinfo)); -EXTERN void jpeg_set_quality JPP((j_compress_ptr cinfo, int quality, - boolean force_baseline)); -EXTERN void jpeg_set_linear_quality JPP((j_compress_ptr cinfo, - int scale_factor, - boolean force_baseline)); -EXTERN void jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl, - const unsigned int *basic_table, - int scale_factor, - boolean force_baseline)); -EXTERN int jpeg_quality_scaling JPP((int quality)); -EXTERN void jpeg_simple_progression JPP((j_compress_ptr cinfo)); -EXTERN void jpeg_suppress_tables JPP((j_compress_ptr cinfo, - boolean suppress)); -EXTERN JQUANT_TBL * jpeg_alloc_quant_table JPP((j_common_ptr cinfo)); -EXTERN JHUFF_TBL * jpeg_alloc_huff_table JPP((j_common_ptr cinfo)); +EXTERN(void) jpeg_set_colorspace JPP((j_compress_ptr cinfo, + J_COLOR_SPACE colorspace)); +EXTERN(void) jpeg_default_colorspace JPP((j_compress_ptr cinfo)); +EXTERN(void) jpeg_set_quality JPP((j_compress_ptr cinfo, int quality, + boolean force_baseline)); +EXTERN(void) jpeg_set_linear_quality JPP((j_compress_ptr cinfo, + int scale_factor, + boolean force_baseline)); +EXTERN(void) jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl, + const unsigned int *basic_table, + int scale_factor, + boolean force_baseline)); +EXTERN(int) jpeg_quality_scaling JPP((int quality)); +EXTERN(void) jpeg_simple_progression JPP((j_compress_ptr cinfo)); +EXTERN(void) jpeg_suppress_tables JPP((j_compress_ptr cinfo, + boolean suppress)); +EXTERN(JQUANT_TBL *) jpeg_alloc_quant_table JPP((j_common_ptr cinfo)); +EXTERN(JHUFF_TBL *) jpeg_alloc_huff_table JPP((j_common_ptr cinfo)); /* Main entry points for compression */ -EXTERN void jpeg_start_compress JPP((j_compress_ptr cinfo, - boolean write_all_tables)); -EXTERN JDIMENSION jpeg_write_scanlines JPP((j_compress_ptr cinfo, - JSAMPARRAY scanlines, - JDIMENSION num_lines)); -EXTERN void jpeg_finish_compress JPP((j_compress_ptr cinfo)); +EXTERN(void) jpeg_start_compress JPP((j_compress_ptr cinfo, + boolean write_all_tables)); +EXTERN(JDIMENSION) jpeg_write_scanlines JPP((j_compress_ptr cinfo, + JSAMPARRAY scanlines, + JDIMENSION num_lines)); +EXTERN(void) jpeg_finish_compress JPP((j_compress_ptr cinfo)); /* Replaces jpeg_write_scanlines when writing raw downsampled data. */ -EXTERN JDIMENSION jpeg_write_raw_data JPP((j_compress_ptr cinfo, - JSAMPIMAGE data, - JDIMENSION num_lines)); +EXTERN(JDIMENSION) jpeg_write_raw_data JPP((j_compress_ptr cinfo, + JSAMPIMAGE data, + JDIMENSION num_lines)); /* Write a special marker. See libjpeg.doc concerning safe usage. */ -EXTERN void jpeg_write_marker JPP((j_compress_ptr cinfo, int marker, - const JOCTET *dataptr, unsigned int datalen)); +EXTERN(void) jpeg_write_marker + JPP((j_compress_ptr cinfo, int marker, + const JOCTET * dataptr, unsigned int datalen)); /* Alternate compression function: just write an abbreviated table file */ -EXTERN void jpeg_write_tables JPP((j_compress_ptr cinfo)); +EXTERN(void) jpeg_write_tables JPP((j_compress_ptr cinfo)); /* Decompression startup: read start of JPEG datastream to see what's there */ -EXTERN int jpeg_read_header JPP((j_decompress_ptr cinfo, - boolean require_image)); +EXTERN(int) jpeg_read_header JPP((j_decompress_ptr cinfo, + boolean require_image)); /* Return value is one of: */ #define JPEG_SUSPENDED 0 /* Suspended due to lack of input data */ #define JPEG_HEADER_OK 1 /* Found valid image datastream */ @@ -931,25 +936,25 @@ EXTERN int jpeg_read_header JPP((j_decompress_ptr cinfo, */ /* Main entry points for decompression */ -EXTERN boolean jpeg_start_decompress JPP((j_decompress_ptr cinfo)); -EXTERN JDIMENSION jpeg_read_scanlines JPP((j_decompress_ptr cinfo, - JSAMPARRAY scanlines, - JDIMENSION max_lines)); -EXTERN boolean jpeg_finish_decompress JPP((j_decompress_ptr cinfo)); +EXTERN(boolean) jpeg_start_decompress JPP((j_decompress_ptr cinfo)); +EXTERN(JDIMENSION) jpeg_read_scanlines JPP((j_decompress_ptr cinfo, + JSAMPARRAY scanlines, + JDIMENSION max_lines)); +EXTERN(boolean) jpeg_finish_decompress JPP((j_decompress_ptr cinfo)); /* Replaces jpeg_read_scanlines when reading raw downsampled data. */ -EXTERN JDIMENSION jpeg_read_raw_data JPP((j_decompress_ptr cinfo, - JSAMPIMAGE data, - JDIMENSION max_lines)); +EXTERN(JDIMENSION) jpeg_read_raw_data JPP((j_decompress_ptr cinfo, + JSAMPIMAGE data, + JDIMENSION max_lines)); /* Additional entry points for buffered-image mode. */ -EXTERN boolean jpeg_has_multiple_scans JPP((j_decompress_ptr cinfo)); -EXTERN boolean jpeg_start_output JPP((j_decompress_ptr cinfo, - int scan_number)); -EXTERN boolean jpeg_finish_output JPP((j_decompress_ptr cinfo)); -EXTERN boolean jpeg_input_complete JPP((j_decompress_ptr cinfo)); -EXTERN void jpeg_new_colormap JPP((j_decompress_ptr cinfo)); -EXTERN int jpeg_consume_input JPP((j_decompress_ptr cinfo)); +EXTERN(boolean) jpeg_has_multiple_scans JPP((j_decompress_ptr cinfo)); +EXTERN(boolean) jpeg_start_output JPP((j_decompress_ptr cinfo, + int scan_number)); +EXTERN(boolean) jpeg_finish_output JPP((j_decompress_ptr cinfo)); +EXTERN(boolean) jpeg_input_complete JPP((j_decompress_ptr cinfo)); +EXTERN(void) jpeg_new_colormap JPP((j_decompress_ptr cinfo)); +EXTERN(int) jpeg_consume_input JPP((j_decompress_ptr cinfo)); /* Return value is one of: */ /* #define JPEG_SUSPENDED 0 Suspended due to lack of input data */ #define JPEG_REACHED_SOS 1 /* Reached start of new scan */ @@ -958,19 +963,19 @@ EXTERN int jpeg_consume_input JPP((j_decompress_ptr cinfo)); #define JPEG_SCAN_COMPLETED 4 /* Completed last iMCU row of a scan */ /* Precalculate output dimensions for current decompression parameters. */ -EXTERN void jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo)); +EXTERN(void) jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo)); /* Install a special processing method for COM or APPn markers. */ -EXTERN void jpeg_set_marker_processor JPP((j_decompress_ptr cinfo, - int marker_code, - jpeg_marker_parser_method routine)); +EXTERN(void) jpeg_set_marker_processor + JPP((j_decompress_ptr cinfo, int marker_code, + jpeg_marker_parser_method routine)); /* Read or write raw DCT coefficients --- useful for lossless transcoding. */ -EXTERN jvirt_barray_ptr * jpeg_read_coefficients JPP((j_decompress_ptr cinfo)); -EXTERN void jpeg_write_coefficients JPP((j_compress_ptr cinfo, - jvirt_barray_ptr * coef_arrays)); -EXTERN void jpeg_copy_critical_parameters JPP((j_decompress_ptr srcinfo, - j_compress_ptr dstinfo)); +EXTERN(jvirt_barray_ptr *) jpeg_read_coefficients JPP((j_decompress_ptr cinfo)); +EXTERN(void) jpeg_write_coefficients JPP((j_compress_ptr cinfo, + jvirt_barray_ptr * coef_arrays)); +EXTERN(void) jpeg_copy_critical_parameters JPP((j_decompress_ptr srcinfo, + j_compress_ptr dstinfo)); /* If you choose to abort compression or decompression before completing * jpeg_finish_(de)compress, then you need to clean up to release memory, @@ -978,18 +983,18 @@ EXTERN void jpeg_copy_critical_parameters JPP((j_decompress_ptr srcinfo, * if you're done with the JPEG object, but if you want to clean it up and * reuse it, call this: */ -EXTERN void jpeg_abort_compress JPP((j_compress_ptr cinfo)); -EXTERN void jpeg_abort_decompress JPP((j_decompress_ptr cinfo)); +EXTERN(void) jpeg_abort_compress JPP((j_compress_ptr cinfo)); +EXTERN(void) jpeg_abort_decompress JPP((j_decompress_ptr cinfo)); /* Generic versions of jpeg_abort and jpeg_destroy that work on either * flavor of JPEG object. These may be more convenient in some places. */ -EXTERN void jpeg_abort JPP((j_common_ptr cinfo)); -EXTERN void jpeg_destroy JPP((j_common_ptr cinfo)); +EXTERN(void) jpeg_abort JPP((j_common_ptr cinfo)); +EXTERN(void) jpeg_destroy JPP((j_common_ptr cinfo)); /* Default restart-marker-resync procedure for use by data source modules */ -EXTERN boolean jpeg_resync_to_restart JPP((j_decompress_ptr cinfo, - int desired)); +EXTERN(boolean) jpeg_resync_to_restart JPP((j_decompress_ptr cinfo, + int desired)); /* These marker codes are exported since applications and data source modules diff --git a/jpegtran.c b/jpegtran.c index f602c6b..5190102 100644 --- a/jpegtran.c +++ b/jpegtran.c @@ -1,7 +1,7 @@ /* * jpegtran.c * - * Copyright (C) 1995, Thomas G. Lane. + * Copyright (C) 1995-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -15,7 +15,8 @@ #ifdef USE_CCOMMAND /* command-line reader for Macintosh */ #ifdef __MWERKS__ -#include /* Metrowerks declares it here */ +#include /* Metrowerks needs this */ +#include /* ... and this */ #endif #ifdef THINK_C #include /* Think declares it here */ @@ -36,7 +37,7 @@ static const char * progname; /* program name for error messages */ static char * outfilename; /* for -outfile switch */ -LOCAL void +LOCAL(void) usage (void) /* complain about bad command line */ { @@ -70,7 +71,7 @@ usage (void) } -LOCAL int +LOCAL(int) parse_switches (j_compress_ptr cinfo, int argc, char **argv, int last_file_arg_seen, boolean for_real) /* Parse optional switches. @@ -229,7 +230,7 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, * The main program. */ -GLOBAL int +int main (int argc, char **argv) { struct jpeg_decompress_struct srcinfo; @@ -274,6 +275,7 @@ main (int argc, char **argv) file_index = parse_switches(&dstinfo, argc, argv, 0, FALSE); jsrcerr.trace_level = jdsterr.trace_level; + srcinfo.mem->max_memory_to_use = dstinfo.mem->max_memory_to_use; #ifdef TWO_FILE_COMMANDLINE /* Must have either -outfile switch or explicit output file name */ diff --git a/jquant1.c b/jquant1.c index 035e79a..b2f96aa 100644 --- a/jquant1.c +++ b/jquant1.c @@ -1,7 +1,7 @@ /* * jquant1.c * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -182,7 +182,7 @@ typedef my_cquantizer * my_cquantize_ptr; */ -LOCAL int +LOCAL(int) select_ncolors (j_decompress_ptr cinfo, int Ncolors[]) /* Determine allocation of desired colors to components, */ /* and fill in Ncolors[] array to indicate choice. */ @@ -241,7 +241,7 @@ select_ncolors (j_decompress_ptr cinfo, int Ncolors[]) } -LOCAL int +LOCAL(int) output_value (j_decompress_ptr cinfo, int ci, int j, int maxj) /* Return j'th output value, where j will range from 0 to maxj */ /* The output values must fall in 0..MAXJSAMPLE in increasing order */ @@ -255,7 +255,7 @@ output_value (j_decompress_ptr cinfo, int ci, int j, int maxj) } -LOCAL int +LOCAL(int) largest_input_value (j_decompress_ptr cinfo, int ci, int j, int maxj) /* Return largest input value that should map to j'th output value */ /* Must have largest(j=0) >= 0, and largest(j=maxj) >= MAXJSAMPLE */ @@ -269,7 +269,7 @@ largest_input_value (j_decompress_ptr cinfo, int ci, int j, int maxj) * Create the colormap. */ -LOCAL void +LOCAL(void) create_colormap (j_decompress_ptr cinfo) { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; @@ -329,7 +329,7 @@ create_colormap (j_decompress_ptr cinfo) * Create the color index table. */ -LOCAL void +LOCAL(void) create_colorindex (j_decompress_ptr cinfo) { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; @@ -392,7 +392,7 @@ create_colorindex (j_decompress_ptr cinfo) * distinct output values. */ -LOCAL ODITHER_MATRIX_PTR +LOCAL(ODITHER_MATRIX_PTR) make_odither_array (j_decompress_ptr cinfo, int ncolors) { ODITHER_MATRIX_PTR odither; @@ -428,7 +428,7 @@ make_odither_array (j_decompress_ptr cinfo, int ncolors) * share a dither table. */ -LOCAL void +LOCAL(void) create_odither_tables (j_decompress_ptr cinfo) { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; @@ -455,7 +455,7 @@ create_odither_tables (j_decompress_ptr cinfo) * Map some rows of pixels to the output colormapped representation. */ -METHODDEF void +METHODDEF(void) color_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) /* General case, no dithering */ @@ -483,7 +483,7 @@ color_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf, } -METHODDEF void +METHODDEF(void) color_quantize3 (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) /* Fast path for out_color_components==3, no dithering */ @@ -511,7 +511,7 @@ color_quantize3 (j_decompress_ptr cinfo, JSAMPARRAY input_buf, } -METHODDEF void +METHODDEF(void) quantize_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) /* General case, with ordered dithering */ @@ -561,7 +561,7 @@ quantize_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, } -METHODDEF void +METHODDEF(void) quantize3_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) /* Fast path for out_color_components==3, with ordered dithering */ @@ -606,7 +606,7 @@ quantize3_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, } -METHODDEF void +METHODDEF(void) quantize_fs_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) /* General case, with Floyd-Steinberg dithering */ @@ -718,7 +718,7 @@ quantize_fs_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, * Allocate workspace for Floyd-Steinberg errors. */ -LOCAL void +LOCAL(void) alloc_fs_workspace (j_decompress_ptr cinfo) { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; @@ -737,7 +737,7 @@ alloc_fs_workspace (j_decompress_ptr cinfo) * Initialize for one-pass color quantization. */ -METHODDEF void +METHODDEF(void) start_pass_1_quant (j_decompress_ptr cinfo, boolean is_pre_scan) { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; @@ -794,7 +794,7 @@ start_pass_1_quant (j_decompress_ptr cinfo, boolean is_pre_scan) * Finish up at the end of the pass. */ -METHODDEF void +METHODDEF(void) finish_pass_1_quant (j_decompress_ptr cinfo) { /* no work in 1-pass case */ @@ -806,7 +806,7 @@ finish_pass_1_quant (j_decompress_ptr cinfo) * Shouldn't get to this module! */ -METHODDEF void +METHODDEF(void) new_color_map_1_quant (j_decompress_ptr cinfo) { ERREXIT(cinfo, JERR_MODE_CHANGE); @@ -817,7 +817,7 @@ new_color_map_1_quant (j_decompress_ptr cinfo) * Module initialization routine for 1-pass color quantization. */ -GLOBAL void +GLOBAL(void) jinit_1pass_quantizer (j_decompress_ptr cinfo) { my_cquantize_ptr cquantize; diff --git a/jquant2.c b/jquant2.c index 2504398..af601e3 100644 --- a/jquant2.c +++ b/jquant2.c @@ -1,7 +1,7 @@ /* * jquant2.c * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -220,7 +220,7 @@ typedef my_cquantizer * my_cquantize_ptr; * NULL pointer). */ -METHODDEF void +METHODDEF(void) prescan_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) { @@ -269,7 +269,7 @@ typedef struct { typedef box * boxptr; -LOCAL boxptr +LOCAL(boxptr) find_biggest_color_pop (boxptr boxlist, int numboxes) /* Find the splittable box with the largest color population */ /* Returns NULL if no splittable boxes remain */ @@ -289,7 +289,7 @@ find_biggest_color_pop (boxptr boxlist, int numboxes) } -LOCAL boxptr +LOCAL(boxptr) find_biggest_volume (boxptr boxlist, int numboxes) /* Find the splittable box with the largest (scaled) volume */ /* Returns NULL if no splittable boxes remain */ @@ -309,7 +309,7 @@ find_biggest_volume (boxptr boxlist, int numboxes) } -LOCAL void +LOCAL(void) update_box (j_decompress_ptr cinfo, boxptr boxp) /* Shrink the min/max bounds of a box to enclose only nonzero elements, */ /* and recompute its volume and population */ @@ -420,7 +420,7 @@ update_box (j_decompress_ptr cinfo, boxptr boxp) } -LOCAL int +LOCAL(int) median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes, int desired_colors) /* Repeatedly select and split the largest box until we have enough boxes */ @@ -495,7 +495,7 @@ median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes, } -LOCAL void +LOCAL(void) compute_color (j_decompress_ptr cinfo, boxptr boxp, int icolor) /* Compute representative color for a box, put it in colormap[icolor] */ { @@ -535,7 +535,7 @@ compute_color (j_decompress_ptr cinfo, boxptr boxp, int icolor) } -LOCAL void +LOCAL(void) select_colors (j_decompress_ptr cinfo, int desired_colors) /* Master routine for color selection */ { @@ -642,7 +642,7 @@ select_colors (j_decompress_ptr cinfo, int desired_colors) * inner-loop variables. */ -LOCAL int +LOCAL(int) find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, JSAMPLE colorlist[]) /* Locate the colormap entries close enough to an update box to be candidates @@ -771,7 +771,7 @@ find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, } -LOCAL void +LOCAL(void) find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, int numcolors, JSAMPLE colorlist[], JSAMPLE bestcolor[]) /* Find the closest colormap entry for each cell in the update box, @@ -851,7 +851,7 @@ find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, } -LOCAL void +LOCAL(void) fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2) /* Fill the inverse-colormap entries in the update box that contains */ /* histogram cell c0/c1/c2. (Only that one cell MUST be filled, but */ @@ -911,7 +911,7 @@ fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2) * Map some rows of pixels to the output colormapped representation. */ -METHODDEF void +METHODDEF(void) pass2_no_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) /* This version performs no dithering */ @@ -945,7 +945,7 @@ pass2_no_dither (j_decompress_ptr cinfo, } -METHODDEF void +METHODDEF(void) pass2_fs_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) /* This version performs Floyd-Steinberg dithering */ @@ -1104,7 +1104,7 @@ pass2_fs_dither (j_decompress_ptr cinfo, * to Aaron Giles for this idea. */ -LOCAL void +LOCAL(void) init_error_limit (j_decompress_ptr cinfo) /* Allocate and fill in the error_limiter table */ { @@ -1139,7 +1139,7 @@ init_error_limit (j_decompress_ptr cinfo) * Finish up at the end of each pass. */ -METHODDEF void +METHODDEF(void) finish_pass1 (j_decompress_ptr cinfo) { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; @@ -1152,7 +1152,7 @@ finish_pass1 (j_decompress_ptr cinfo) } -METHODDEF void +METHODDEF(void) finish_pass2 (j_decompress_ptr cinfo) { /* no work */ @@ -1163,7 +1163,7 @@ finish_pass2 (j_decompress_ptr cinfo) * Initialize for each processing pass. */ -METHODDEF void +METHODDEF(void) start_pass_2_quant (j_decompress_ptr cinfo, boolean is_pre_scan) { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; @@ -1226,7 +1226,7 @@ start_pass_2_quant (j_decompress_ptr cinfo, boolean is_pre_scan) * Switch to a new external colormap between output passes. */ -METHODDEF void +METHODDEF(void) new_color_map_2_quant (j_decompress_ptr cinfo) { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; @@ -1240,7 +1240,7 @@ new_color_map_2_quant (j_decompress_ptr cinfo) * Module initialization routine for 2-pass color quantization. */ -GLOBAL void +GLOBAL(void) jinit_2pass_quantizer (j_decompress_ptr cinfo) { my_cquantize_ptr cquantize; diff --git a/jutils.c b/jutils.c index 4ba2a54..d18a955 100644 --- a/jutils.c +++ b/jutils.c @@ -1,7 +1,7 @@ /* * jutils.c * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -21,6 +21,8 @@ * of a DCT block read in natural order (left to right, top to bottom). */ +#if 0 /* This table is not actually needed in v6a */ + const int jpeg_zigzag_order[DCTSIZE2] = { 0, 1, 5, 6, 14, 15, 27, 28, 2, 4, 7, 13, 16, 26, 29, 42, @@ -32,6 +34,8 @@ const int jpeg_zigzag_order[DCTSIZE2] = { 35, 36, 48, 49, 57, 58, 62, 63 }; +#endif + /* * jpeg_natural_order[i] is the natural-order position of the i'th element * of zigzag order. @@ -64,7 +68,7 @@ const int jpeg_natural_order[DCTSIZE2+16] = { * Arithmetic utilities */ -GLOBAL long +GLOBAL(long) jdiv_round_up (long a, long b) /* Compute a/b rounded up to next integer, ie, ceil(a/b) */ /* Assumes a >= 0, b > 0 */ @@ -73,7 +77,7 @@ jdiv_round_up (long a, long b) } -GLOBAL long +GLOBAL(long) jround_up (long a, long b) /* Compute a rounded up to next multiple of b, ie, ceil(a/b)*b */ /* Assumes a >= 0, b > 0 */ @@ -103,7 +107,7 @@ jround_up (long a, long b) #endif -GLOBAL void +GLOBAL(void) jcopy_sample_rows (JSAMPARRAY input_array, int source_row, JSAMPARRAY output_array, int dest_row, int num_rows, JDIMENSION num_cols) @@ -137,7 +141,7 @@ jcopy_sample_rows (JSAMPARRAY input_array, int source_row, } -GLOBAL void +GLOBAL(void) jcopy_block_row (JBLOCKROW input_row, JBLOCKROW output_row, JDIMENSION num_blocks) /* Copy a row of coefficient blocks from one place to another. */ @@ -157,7 +161,7 @@ jcopy_block_row (JBLOCKROW input_row, JBLOCKROW output_row, } -GLOBAL void +GLOBAL(void) jzero_far (void FAR * target, size_t bytestozero) /* Zero out a chunk of FAR memory. */ /* This might be sample-array data, block-array data, or alloc_large data. */ diff --git a/jversion.h b/jversion.h index f2f1b8d..b903be7 100644 --- a/jversion.h +++ b/jversion.h @@ -1,7 +1,7 @@ /* * jversion.h * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -9,6 +9,6 @@ */ -#define JVERSION "6 2-Aug-95" +#define JVERSION "6a 7-Feb-96" -#define JCOPYRIGHT "Copyright (C) 1995, Thomas G. Lane" +#define JCOPYRIGHT "Copyright (C) 1996, Thomas G. Lane" diff --git a/libjpeg.doc b/libjpeg.doc index cffa4f7..b3333a8 100644 --- a/libjpeg.doc +++ b/libjpeg.doc @@ -1,6 +1,6 @@ USING THE IJG JPEG LIBRARY -Copyright (C) 1994-1995, Thomas G. Lane. +Copyright (C) 1994-1996, Thomas G. Lane. This file is part of the Independent JPEG Group's software. For conditions of distribution and use, see the accompanying README file. @@ -186,19 +186,20 @@ Before diving into procedural details, it is helpful to understand the image data format that the JPEG library expects or returns. The standard input image format is a rectangular array of pixels, with each -pixel having the same number of "component" values (color channels). You -must specify how many components there are and the colorspace interpretation -of the components. Most applications will use RGB data (three components -per pixel) or grayscale data (one component per pixel). PLEASE NOTE THAT -RGB DATA IS THREE SAMPLES PER PIXEL, GRAYSCALE ONLY ONE. A remarkable -number of people manage to miss this, only to find that their programs don't -work with grayscale JPEG files. +pixel having the same number of "component" or "sample" values (color +channels). You must specify how many components there are and the colorspace +interpretation of the components. Most applications will use RGB data +(three components per pixel) or grayscale data (one component per pixel). +PLEASE NOTE THAT RGB DATA IS THREE SAMPLES PER PIXEL, GRAYSCALE ONLY ONE. +A remarkable number of people manage to miss this, only to find that their +programs don't work with grayscale JPEG files. -Note that there is no provision for colormapped input. You can feed in a -colormapped image by expanding it to full-color format. However JPEG often -doesn't work very well with colormapped source data, because of dithering -noise. This is discussed in more detail in the JPEG FAQ and the other -references mentioned in the README file. +There is no provision for colormapped input. JPEG files are always full-color +or full grayscale (or sometimes another colorspace such as CMYK). You can +feed in a colormapped image by expanding it to full-color format. However +JPEG often doesn't work very well with source data that has been colormapped, +because of dithering noise. This is discussed in more detail in the JPEG FAQ +and the other references mentioned in the README file. Pixels are stored by scanlines, with each scanline running from left to right. The component values for each pixel are adjacent in the row; for @@ -227,8 +228,11 @@ byte before passing it to the compressor. If you need to compress data that has more than 8 bits/channel, compile with BITS_IN_JSAMPLE = 12. (See "Library compile-time options", later.) + The data format returned by the decompressor is the same in all details, -except that colormapped data is supported. If you request colormapped +except that colormapped output is supported. (Again, a JPEG file is never +colormapped. But you can ask the decompressor to perform on-the-fly color +quantization to deliver colormapped output.) If you request colormapped output then the returned data array contains a single JSAMPLE per pixel; its value is an index into a color map. The color map is represented as a 2-D JSAMPARRAY in which each row holds the values of one color component, @@ -666,12 +670,13 @@ The return value always equals the change in the value of output_scanline. If you don't use a suspending data source, it is safe to assume that jpeg_read_scanlines() reads at least one scanline per call, until the -bottom of the image has been reached. If you use a buffer larger than one -scanline, it is NOT safe to assume that jpeg_read_scanlines() fills it. -(The current implementation won't return more than cinfo.rec_outbuf_height -scanlines per call, no matter how large a buffer you pass.) So you must -always provide a loop that calls jpeg_read_scanlines() repeatedly until -the whole image has been read. +bottom of the image has been reached. + +If you use a buffer larger than one scanline, it is NOT safe to assume that +jpeg_read_scanlines() fills it. (The current implementation won't return +more than cinfo.rec_outbuf_height scanlines per call, no matter how large +a buffer you pass.) So you must always provide a loop that calls +jpeg_read_scanlines() repeatedly until the whole image has been read. 7. jpeg_finish_decompress(...); @@ -831,9 +836,14 @@ jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl, int scale_factor, boolean force_baseline) Allows an arbitrary quantization table to be created. which_tbl indicates which table slot to fill. basic_table points to an array - of 64 unsigned ints given in JPEG zigzag order. These values are + of 64 unsigned ints given in normal array order. These values are multiplied by scale_factor/100 and then clamped to the range 1..65535 (or to 1..255 if force_baseline is TRUE). + CAUTION: prior to library version 6a, jpeg_add_quant_table expected + the basic table to be given in JPEG zigzag order. If you need to + write code that works with either older or newer versions of this + routine, you must check the library version number. Something like + "#if JPEG_LIB_VERSION >= 61" is the right test. jpeg_simple_progression (j_compress_ptr cinfo) Generates a default scan script for writing a progressive-JPEG file. @@ -1825,7 +1835,7 @@ JPEG_REACHED_EOI. The target scan number passed to jpeg_start_output() is saved in the cinfo.output_scan_number field. The library's output processing calls jpeg_consume_input() whenever the current input scan number and row within -the scan is less than or equal to the current output scan number and row. +that scan is less than or equal to the current output scan number and row. Thus, input processing can "get ahead" of the output processing but is not allowed to "fall behind". You can achieve several different effects by manipulating this interlock rule. For example, if you pass a target scan @@ -1844,10 +1854,26 @@ processor to simply display whatever it finds in the image buffer, without waiting for input. (However, the library will not accept a target scan number less than one, so you can't avoid waiting for the first scan.) -When using jpeg_consume_input(), you'll typically want to be sure that you -perform a final output pass after receiving all the data; otherwise your last -display may not be full quality across the whole screen. So the right outer -loop logic is something like this: +When data is arriving faster than the output display processing can advance +through the image, jpeg_consume_input() will store data into the buffered +image beyond the point at which the output processing is reading data out +again. If the input arrives fast enough, it may "wrap around" the buffer to +the point where the input is more than one whole scan ahead of the output. +If the output processing simply proceeds through its display pass without +paying attention to the input, the effect seen on-screen is that the lower +part of the image is one or more scans better in quality than the upper part. +Then, when the next output scan is started, you have a choice of what target +scan number to use. The recommended choice is to use the current input scan +number at that time, which implies that you've skipped the output scans +corresponding to the input scans that were completed while you processed the +previous output scan. In this way, the decoder automatically adapts its +speed to the arriving data, by skipping output scans as necessary to keep up +with the arriving data. + +When using this strategy, you'll want to be sure that you perform a final +output pass after receiving all the data; otherwise your last display may not +be full quality across the whole screen. So the right outer loop logic is +something like this: do { absorb any waiting input by calling jpeg_consume_input() final_pass = jpeg_input_complete(&cinfo); @@ -1869,15 +1895,15 @@ the final pass, the right loop logic is like this: cinfo.input_scan_number == cinfo.output_scan_number) break; } -In this case you don't need to know in advance whether an output pass is -the last one, so it's not necessary to have reached EOF before starting the -final output pass; rather, what you want to test is whether the output pass -was performed in sync with the final input scan. This form of the loop -will avoid an extra output pass whenever the decoder is able (or nearly -able) to keep up with the incoming data. +In this case you don't need to know in advance whether an output pass is to +be the last one, so it's not necessary to have reached EOF before starting +the final output pass; rather, what you want to test is whether the output +pass was performed in sync with the final input scan. This form of the loop +will avoid an extra output pass whenever the decoder is able (or nearly able) +to keep up with the incoming data. When the data transmission speed is high, you might begin a display pass, -then find that much or all of the image has arrived before you can complete +then find that much or all of the file has arrived before you can complete the pass. (You can detect this by noting the JPEG_REACHED_EOI return code from jpeg_consume_input(), or equivalently by testing jpeg_input_complete().) In this situation you may wish to abort the current display pass and start a @@ -1916,10 +1942,10 @@ routines: * jpeg_read_scanlines(), as always, returns the number of scanlines that it was able to produce before suspending. * jpeg_finish_output() will read any markers following the target scan, - up to the end of the image or the SOS marker that begins another scan. + up to the end of the file or the SOS marker that begins another scan. (But it reads no input if jpeg_consume_input() has already reached the - end of the image or a SOS marker beyond the target output scan.) -* jpeg_finish_decompress() will read until the end of image, and thus can + end of the file or a SOS marker beyond the target output scan.) +* jpeg_finish_decompress() will read until the end of file, and thus can suspend if the end hasn't already been reached (as can be tested by calling jpeg_input_complete()). jpeg_start_output(), jpeg_finish_output(), and jpeg_finish_decompress() @@ -2153,7 +2179,8 @@ In some cases you might want to compress an image using tables which are not stored in the application, but are defined in an interchange or tables-only file readable by the application. This can be done by setting up a JPEG decompression object to read the specification file, then copying the -tables into your compression object. +tables into your compression object. See jpeg_copy_critical_parameters() +for an example of copying quantization tables. To read abbreviated image files, you simply need to load the proper tables @@ -2603,8 +2630,9 @@ DOS will require a reboot to recover the memory.) Thus, with these memory managers, it's a good idea to provide a signal handler that will trap any early exit from your program. The handler should call either jpeg_abort() or jpeg_destroy() for any active JPEG objects. A handler is not needed with -jmemnobs.c, and shouldn't be necessary with jmemansi.c either, since the C -library is supposed to take care of deleting files made with tmpfile(). +jmemnobs.c, and shouldn't be necessary with jmemansi.c or jmemmac.c either, +since the C library is supposed to take care of deleting files made with +tmpfile(). Library compile-time options diff --git a/makefile.ansi b/makefile.ansi index ff0bc66..8175ca0 100644 --- a/makefile.ansi +++ b/makefile.ansi @@ -45,13 +45,14 @@ LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \ jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \ jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \ jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \ - jquant2.c jutils.c jmemmgr.c jmemansi.c jmemname.c jmemnobs.c \ - jmemdos.c + jquant2.c jutils.c jmemmgr.c +# memmgr back ends: compile only one of these into a working library +SYSDEPSOURCES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c # source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom APPSOURCES= cjpeg.c djpeg.c jpegtran.c cdjpeg.c rdcolmap.c rdswitch.c \ rdjpgcom.c wrjpgcom.c rdppm.c wrppm.c rdgif.c wrgif.c rdtarga.c \ wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c -SOURCES= $(LIBSOURCES) $(APPSOURCES) +SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES) # files included by source files INCLUDES= jchuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \ jpegint.h jpeglib.h jversion.h cdjpeg.h cderror.h @@ -188,6 +189,7 @@ jmemansi.o: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerro jmemname.o: jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h jmemnobs.o: jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h jmemdos.o: jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h +jmemmac.o: jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h cjpeg.o: cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h djpeg.o: djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h jpegtran.o: jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h diff --git a/makefile.bcc b/makefile.bcc index 8281beb..4f20bea 100644 --- a/makefile.bcc +++ b/makefile.bcc @@ -10,10 +10,10 @@ # Are we under DOS or OS/2? !if !$d(DOS) && !$d(OS2) -!if $d(__MSDOS__) -DOS=1 -!else +!if $d(__OS2__) OS2=1 +!else +DOS=1 !endif !endif @@ -70,13 +70,14 @@ LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \ jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \ jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \ jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \ - jquant2.c jutils.c jmemmgr.c jmemansi.c jmemname.c jmemnobs.c \ - jmemdos.c + jquant2.c jutils.c jmemmgr.c +# memmgr back ends: compile only one of these into a working library +SYSDEPSOURCES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c # source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom APPSOURCES= cjpeg.c djpeg.c jpegtran.c cdjpeg.c rdcolmap.c rdswitch.c \ rdjpgcom.c wrjpgcom.c rdppm.c wrppm.c rdgif.c wrgif.c rdtarga.c \ wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c -SOURCES= $(LIBSOURCES) $(APPSOURCES) +SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES) # files included by source files INCLUDES= jchuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \ jpegint.h jpeglib.h jversion.h cdjpeg.h cderror.h @@ -255,6 +256,7 @@ jmemansi.obj: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jer jmemname.obj: jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h jmemnobs.obj: jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h jmemdos.obj: jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h +jmemmac.obj: jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h cjpeg.obj: cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h djpeg.obj: djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h jpegtran.obj: jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h @@ -273,5 +275,5 @@ rdbmp.obj: rdbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h c wrbmp.obj: wrbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h rdrle.obj: rdrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h wrrle.obj: wrrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -jmemdosa.obj : jmemdosa.asm +jmemdosa.obj: jmemdosa.asm tasm /mx jmemdosa.asm diff --git a/makefile.cfg b/makefile.cfg index 3017b79..d3241c6 100644 --- a/makefile.cfg +++ b/makefile.cfg @@ -68,13 +68,14 @@ LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \ jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \ jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \ jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \ - jquant2.c jutils.c jmemmgr.c jmemansi.c jmemname.c jmemnobs.c \ - jmemdos.c + jquant2.c jutils.c jmemmgr.c +# memmgr back ends: compile only one of these into a working library +SYSDEPSOURCES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c # source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom APPSOURCES= cjpeg.c djpeg.c jpegtran.c cdjpeg.c rdcolmap.c rdswitch.c \ rdjpgcom.c wrjpgcom.c rdppm.c wrppm.c rdgif.c wrgif.c rdtarga.c \ wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c -SOURCES= $(LIBSOURCES) $(APPSOURCES) +SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES) # files included by source files INCLUDES= jchuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \ jpegint.h jpeglib.h jversion.h cdjpeg.h cderror.h @@ -252,6 +253,7 @@ jmemansi.o: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerro jmemname.o: jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h jmemnobs.o: jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h jmemdos.o: jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h +jmemmac.o: jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h cjpeg.o: cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h djpeg.o: djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h jpegtran.o: jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h diff --git a/makefile.dj b/makefile.dj index 59897fc..811fd7d 100644 --- a/makefile.dj +++ b/makefile.dj @@ -49,13 +49,14 @@ LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \ jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \ jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \ jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \ - jquant2.c jutils.c jmemmgr.c jmemansi.c jmemname.c jmemnobs.c \ - jmemdos.c + jquant2.c jutils.c jmemmgr.c +# memmgr back ends: compile only one of these into a working library +SYSDEPSOURCES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c # source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom APPSOURCES= cjpeg.c djpeg.c jpegtran.c cdjpeg.c rdcolmap.c rdswitch.c \ rdjpgcom.c wrjpgcom.c rdppm.c wrppm.c rdgif.c wrgif.c rdtarga.c \ wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c -SOURCES= $(LIBSOURCES) $(APPSOURCES) +SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES) # files included by source files INCLUDES= jchuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \ jpegint.h jpeglib.h jversion.h cdjpeg.h cderror.h @@ -212,6 +213,7 @@ jmemansi.o: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerro jmemname.o: jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h jmemnobs.o: jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h jmemdos.o: jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h +jmemmac.o: jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h cjpeg.o: cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h djpeg.o: djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h jpegtran.o: jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h diff --git a/makefile.manx b/makefile.manx index 26e6503..fa035fc 100644 --- a/makefile.manx +++ b/makefile.manx @@ -46,13 +46,14 @@ LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \ jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \ jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \ jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \ - jquant2.c jutils.c jmemmgr.c jmemansi.c jmemname.c jmemnobs.c \ - jmemdos.c + jquant2.c jutils.c jmemmgr.c +# memmgr back ends: compile only one of these into a working library +SYSDEPSOURCES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c # source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom APPSOURCES= cjpeg.c djpeg.c jpegtran.c cdjpeg.c rdcolmap.c rdswitch.c \ rdjpgcom.c wrjpgcom.c rdppm.c wrppm.c rdgif.c wrgif.c rdtarga.c \ wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c -SOURCES= $(LIBSOURCES) $(APPSOURCES) +SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES) # files included by source files INCLUDES= jchuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \ jpegint.h jpeglib.h jversion.h cdjpeg.h cderror.h @@ -188,6 +189,7 @@ jmemansi.o: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerro jmemname.o: jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h jmemnobs.o: jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h jmemdos.o: jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h +jmemmac.o: jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h cjpeg.o: cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h djpeg.o: djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h jpegtran.o: jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h diff --git a/makefile.mc6 b/makefile.mc6 index d027e64..a8ab313 100644 --- a/makefile.mc6 +++ b/makefile.mc6 @@ -32,13 +32,14 @@ LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \ jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \ jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \ jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \ - jquant2.c jutils.c jmemmgr.c jmemansi.c jmemname.c jmemnobs.c \ - jmemdos.c + jquant2.c jutils.c jmemmgr.c +# memmgr back ends: compile only one of these into a working library +SYSDEPSOURCES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c # source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom APPSOURCES= cjpeg.c djpeg.c jpegtran.c cdjpeg.c rdcolmap.c rdswitch.c \ rdjpgcom.c wrjpgcom.c rdppm.c wrppm.c rdgif.c wrgif.c rdtarga.c \ wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c -SOURCES= $(LIBSOURCES) $(APPSOURCES) +SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES) # files included by source files INCLUDES= jchuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \ jpegint.h jpeglib.h jversion.h cdjpeg.h cderror.h @@ -87,10 +88,10 @@ all: libjpeg.lib cjpeg.exe djpeg.exe jpegtran.exe rdjpgcom.exe wrjpgcom.exe libjpeg.lib: $(LIBOBJECTS) $(RFILE) del libjpeg.lib - lib @$(RFILE) ; + lib @$(RFILE) # linker response file for building libjpeg.lib -$(RFILE) : Makefile +$(RFILE) : makefile del $(RFILE) echo libjpeg.lib >$(RFILE) # silly want-to-create-it prompt: @@ -107,7 +108,7 @@ $(RFILE) : Makefile echo +jidctfst.obj +jidctflt.obj +jidctint.obj & >>$(RFILE) echo +jidctred.obj +jdsample.obj +jdcolor.obj +jquant1.obj & >>$(RFILE) echo +jquant2.obj +jdmerge.obj +jcomapi.obj +jutils.obj & >>$(RFILE) - echo +jerror.obj +jmemmgr.obj +jmemdos.obj +jmemdosa.obj >>$(RFILE) + echo +jerror.obj +jmemmgr.obj +jmemdos.obj +jmemdosa.obj ; >>$(RFILE) cjpeg.exe: $(COBJECTS) libjpeg.lib echo $(COBJECTS) >cjpeg.lst @@ -209,6 +210,7 @@ jmemansi.obj: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jer jmemname.obj: jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h jmemnobs.obj: jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h jmemdos.obj: jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h +jmemmac.obj: jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h cjpeg.obj: cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h djpeg.obj: djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h jpegtran.obj: jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h diff --git a/makefile.mms b/makefile.mms index 9c63974..401fe20 100644 --- a/makefile.mms +++ b/makefile.mms @@ -32,13 +32,14 @@ LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \ jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \ jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \ jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \ - jquant2.c jutils.c jmemmgr.c jmemansi.c jmemname.c jmemnobs.c \ - jmemdos.c + jquant2.c jutils.c jmemmgr.c +# memmgr back ends: compile only one of these into a working library +SYSDEPSOURCES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c # source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom APPSOURCES= cjpeg.c djpeg.c jpegtran.c cdjpeg.c rdcolmap.c rdswitch.c \ rdjpgcom.c wrjpgcom.c rdppm.c wrppm.c rdgif.c wrgif.c rdtarga.c \ wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c -SOURCES= $(LIBSOURCES) $(APPSOURCES) +SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES) # files included by source files INCLUDES= jchuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \ jpegint.h jpeglib.h jversion.h cdjpeg.h cderror.h @@ -143,70 +144,71 @@ test : cjpeg.exe djpeg.exe jpegtran.exe - Backup /Compare/Log testorig.jpg testoutt.jpg -jcapimin.obj: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcapistd.obj: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jccoefct.obj: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jccolor.obj: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcdctmgr.obj: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jchuff.obj: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h -jcinit.obj: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcmainct.obj: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcmarker.obj: jcmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcmaster.obj: jcmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcomapi.obj: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcparam.obj: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcphuff.obj: jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h -jcprepct.obj: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcsample.obj: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jctrans.obj: jctrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdapimin.obj: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdapistd.obj: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdatadst.obj: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h -jdatasrc.obj: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h -jdcoefct.obj: jdcoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdcolor.obj: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jddctmgr.obj: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jdhuff.obj: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h -jdinput.obj: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdmainct.obj: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdmarker.obj: jdmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdmaster.obj: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdmerge.obj: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdphuff.obj: jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h -jdpostct.obj: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdsample.obj: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdtrans.obj: jdtrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jerror.obj: jerror.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jversion.h jerror.h -jfdctflt.obj: jfdctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jfdctfst.obj: jfdctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jfdctint.obj: jfdctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jidctflt.obj: jidctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jidctfst.obj: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jidctint.obj: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jidctred.obj: jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jquant1.obj: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jquant2.obj: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jutils.obj: jutils.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jmemmgr.obj: jmemmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h -jmemansi.obj: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h -jmemname.obj: jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h -jmemnobs.obj: jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h -jmemdos.obj: jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h -cjpeg.obj: cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h -djpeg.obj: djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h -jpegtran.obj: jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h -cdjpeg.obj: cdjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdcolmap.obj: rdcolmap.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdswitch.obj: rdswitch.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdjpgcom.obj: rdjpgcom.c jinclude.h jconfig.h -wrjpgcom.obj: wrjpgcom.c jinclude.h jconfig.h -rdppm.obj: rdppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -wrppm.obj: wrppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdgif.obj: rdgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -wrgif.obj: wrgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdtarga.obj: rdtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -wrtarga.obj: wrtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdbmp.obj: rdbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -wrbmp.obj: wrbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdrle.obj: rdrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -wrrle.obj: wrrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h +jcapimin.obj : jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jcapistd.obj : jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jccoefct.obj : jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jccolor.obj : jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jcdctmgr.obj : jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h +jchuff.obj : jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h +jcinit.obj : jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jcmainct.obj : jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jcmarker.obj : jcmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jcmaster.obj : jcmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jcomapi.obj : jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jcparam.obj : jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jcphuff.obj : jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h +jcprepct.obj : jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jcsample.obj : jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jctrans.obj : jctrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jdapimin.obj : jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jdapistd.obj : jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jdatadst.obj : jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h +jdatasrc.obj : jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h +jdcoefct.obj : jdcoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jdcolor.obj : jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jddctmgr.obj : jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h +jdhuff.obj : jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h +jdinput.obj : jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jdmainct.obj : jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jdmarker.obj : jdmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jdmaster.obj : jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jdmerge.obj : jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jdphuff.obj : jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h +jdpostct.obj : jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jdsample.obj : jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jdtrans.obj : jdtrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jerror.obj : jerror.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jversion.h jerror.h +jfdctflt.obj : jfdctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h +jfdctfst.obj : jfdctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h +jfdctint.obj : jfdctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h +jidctflt.obj : jidctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h +jidctfst.obj : jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h +jidctint.obj : jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h +jidctred.obj : jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h +jquant1.obj : jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jquant2.obj : jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jutils.obj : jutils.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h +jmemmgr.obj : jmemmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h +jmemansi.obj : jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h +jmemname.obj : jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h +jmemnobs.obj : jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h +jmemdos.obj : jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h +jmemmac.obj : jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h +cjpeg.obj : cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h +djpeg.obj : djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h +jpegtran.obj : jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h +cdjpeg.obj : cdjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h +rdcolmap.obj : rdcolmap.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h +rdswitch.obj : rdswitch.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h +rdjpgcom.obj : rdjpgcom.c jinclude.h jconfig.h +wrjpgcom.obj : wrjpgcom.c jinclude.h jconfig.h +rdppm.obj : rdppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h +wrppm.obj : wrppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h +rdgif.obj : rdgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h +wrgif.obj : wrgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h +rdtarga.obj : rdtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h +wrtarga.obj : wrtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h +rdbmp.obj : rdbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h +wrbmp.obj : wrbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h +rdrle.obj : rdrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h +wrrle.obj : wrrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h diff --git a/makefile.sas b/makefile.sas index b4b1df8..14be5a4 100644 --- a/makefile.sas +++ b/makefile.sas @@ -54,13 +54,14 @@ LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \ jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \ jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \ jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \ - jquant2.c jutils.c jmemmgr.c jmemansi.c jmemname.c jmemnobs.c \ - jmemdos.c + jquant2.c jutils.c jmemmgr.c +# memmgr back ends: compile only one of these into a working library +SYSDEPSOURCES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c # source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom APPSOURCES= cjpeg.c djpeg.c jpegtran.c cdjpeg.c rdcolmap.c rdswitch.c \ rdjpgcom.c wrjpgcom.c rdppm.c wrppm.c rdgif.c wrgif.c rdtarga.c \ wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c -SOURCES= $(LIBSOURCES) $(APPSOURCES) +SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES) # files included by source files INCLUDES= jchuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \ jpegint.h jpeglib.h jversion.h cdjpeg.h cderror.h @@ -222,6 +223,7 @@ jmemansi.o: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerro jmemname.o: jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h jmemnobs.o: jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h jmemdos.o: jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h +jmemmac.o: jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h cjpeg.o: cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h djpeg.o: djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h jpegtran.o: jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h diff --git a/makefile.unix b/makefile.unix index 1c5390f..2ce9820 100644 --- a/makefile.unix +++ b/makefile.unix @@ -49,13 +49,14 @@ LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \ jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \ jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \ jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \ - jquant2.c jutils.c jmemmgr.c jmemansi.c jmemname.c jmemnobs.c \ - jmemdos.c + jquant2.c jutils.c jmemmgr.c +# memmgr back ends: compile only one of these into a working library +SYSDEPSOURCES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c # source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom APPSOURCES= cjpeg.c djpeg.c jpegtran.c cdjpeg.c rdcolmap.c rdswitch.c \ rdjpgcom.c wrjpgcom.c rdppm.c wrppm.c rdgif.c wrgif.c rdtarga.c \ wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c -SOURCES= $(LIBSOURCES) $(APPSOURCES) +SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES) # files included by source files INCLUDES= jchuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \ jpegint.h jpeglib.h jversion.h cdjpeg.h cderror.h @@ -202,6 +203,7 @@ jmemansi.o: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerro jmemname.o: jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h jmemnobs.o: jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h jmemdos.o: jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h +jmemmac.o: jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h cjpeg.o: cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h djpeg.o: djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h jpegtran.o: jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h diff --git a/makefile.vms b/makefile.vms index 52cfb84..4501847 100644 --- a/makefile.vms +++ b/makefile.vms @@ -8,6 +8,15 @@ $! and Tim Bell (tbell@netcom.com) for their help. $! $! Read installation instructions before running this!! $! +$ If F$Mode () .eqs. "INTERACTIVE" +$ Then +$ VERIFY = F$Verify (0) +$ Else +$ VERIFY = F$Verify (1) +$ EndIf +$ On Control_Y Then GoTo End +$ On Error Then GoTo End +$ $ If F$GetSyi ("HW_MODEL") .gt. 1023 $ Then $ OPT = "" @@ -15,7 +24,7 @@ $ Else $ OPT = ",Sys$Disk:[]makvms.opt/Option" $ EndIf $ -$ DoCompile := CC /NoDebug /Optimize +$ DoCompile := CC /NoDebug /Optimize /NoList $! $ DoCompile jcapimin.c $ DoCompile jcapistd.c @@ -84,8 +93,8 @@ $ DoCompile rdbmp.c $ DoCompile rdswitch.c $ DoCompile cdjpeg.c $! -$ Link /Executable = cjpeg.exe cjpeg.obj,rdppm.obj,rdgif.obj,rdtarga.obj, - - rdrle.obj,rdbmp.obj,rdswitch.obj,cdjpeg.obj,libjpeg.olb/Library'OPT' +$ Link /NoMap /Executable = cjpeg.exe cjpeg.obj,rdppm.obj,rdgif.obj, - + rdtarga.obj,rdrle.obj,rdbmp.obj,rdswitch.obj,cdjpeg.obj,libjpeg.olb/Library'OPT' $! $ DoCompile djpeg.c $ DoCompile wrppm.c @@ -96,20 +105,21 @@ $ DoCompile wrbmp.c $ DoCompile rdcolmap.c $ DoCompile cdjpeg.c $! -$ Link /Executable = djpeg.exe djpeg.obj,wrppm.obj,wrgif.obj,wrtarga.obj, - - wrrle.obj,wrbmp.obj,rdcolmap.obj,cdjpeg.obj,libjpeg.olb/Library'OPT' +$ Link /NoMap /Executable = djpeg.exe djpeg.obj,wrppm.obj,wrgif.obj, - + wrtarga.obj,wrrle.obj,wrbmp.obj,rdcolmap.obj,cdjpeg.obj,libjpeg.olb/Library'OPT' $! $ DoCompile jpegtran.c $ DoCompile rdswitch.c $ DoCompile cdjpeg.c $! -$ Link /Executable = jpegtran.exe jpegtran.obj,rdswitch.obj,cdjpeg.obj,libjpeg.olb/Library'OPT' +$ Link /NoMap /Executable = jpegtran.exe jpegtran.obj,rdswitch.obj, - + cdjpeg.obj,libjpeg.olb/Library'OPT' $! $ DoCompile rdjpgcom.c -$ Link /Executable = rdjpgcom.exe rdjpgcom.obj'OPT' +$ Link /NoMap /Executable = rdjpgcom.exe rdjpgcom.obj'OPT' $! $ DoCompile wrjpgcom.c -$ Link /Executable = wrjpgcom.exe wrjpgcom.obj'OPT' +$ Link /NoMap /Executable = wrjpgcom.exe wrjpgcom.obj'OPT' $! $! Run the self-test $! @@ -126,4 +136,6 @@ $ Backup /Compare/Log testimg.ppm testoutp.ppm $ Backup /Compare/Log testimgp.jpg testoutp.jpg $ Backup /Compare/Log testorig.jpg testoutt.jpg $! +$End: +$ If Verify Then Set Verify $ Exit diff --git a/makefile.wat b/makefile.wat index 01536c7..ff022a0 100644 --- a/makefile.wat +++ b/makefile.wat @@ -44,13 +44,14 @@ LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c & jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c & jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c & jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c & - jquant2.c jutils.c jmemmgr.c jmemansi.c jmemname.c jmemnobs.c & - jmemdos.c + jquant2.c jutils.c jmemmgr.c +# memmgr back ends: compile only one of these into a working library +SYSDEPSOURCES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c # source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom APPSOURCES= cjpeg.c djpeg.c jpegtran.c cdjpeg.c rdcolmap.c rdswitch.c & rdjpgcom.c wrjpgcom.c rdppm.c wrppm.c rdgif.c wrgif.c rdtarga.c & wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c -SOURCES= $(LIBSOURCES) $(APPSOURCES) +SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES) # files included by source files INCLUDES= jchuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h & jpegint.h jpeglib.h jversion.h cdjpeg.h cderror.h @@ -207,6 +208,7 @@ jmemansi.obj: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jer jmemname.obj: jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h jmemnobs.obj: jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h jmemdos.obj: jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h +jmemmac.obj: jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h cjpeg.obj: cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h djpeg.obj: djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h jpegtran.obj: jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h diff --git a/rdbmp.c b/rdbmp.c index 63718c3..b05fe2a 100644 --- a/rdbmp.c +++ b/rdbmp.c @@ -1,7 +1,7 @@ /* * rdbmp.c * - * Copyright (C) 1994-1995, Thomas G. Lane. + * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -64,7 +64,7 @@ typedef struct _bmp_source_struct { } bmp_source_struct; -LOCAL int +LOCAL(int) read_byte (bmp_source_ptr sinfo) /* Read next byte from BMP file */ { @@ -77,7 +77,7 @@ read_byte (bmp_source_ptr sinfo) } -LOCAL void +LOCAL(void) read_colormap (bmp_source_ptr sinfo, int cmaplen, int mapentrysize) /* Read the colormap from a BMP file */ { @@ -115,7 +115,7 @@ read_colormap (bmp_source_ptr sinfo, int cmaplen, int mapentrysize) * it is an 8-bit image, we must expand colormapped pixels to 24bit format. */ -METHODDEF JDIMENSION +METHODDEF(JDIMENSION) get_8bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) /* This version is for reading 8-bit colormap indexes */ { @@ -146,7 +146,7 @@ get_8bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) } -METHODDEF JDIMENSION +METHODDEF(JDIMENSION) get_24bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) /* This version is for reading 24-bit pixels */ { @@ -183,7 +183,7 @@ get_24bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) * get_8bit_row or get_24bit_row on subsequent calls. */ -METHODDEF JDIMENSION +METHODDEF(JDIMENSION) preload_image (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) { bmp_source_ptr source = (bmp_source_ptr) sinfo; @@ -237,7 +237,7 @@ preload_image (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) * Read the file header; return image size and component count. */ -METHODDEF void +METHODDEF(void) start_input_bmp (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) { bmp_source_ptr source = (bmp_source_ptr) sinfo; @@ -408,7 +408,7 @@ start_input_bmp (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) * Finish up at the end of the file. */ -METHODDEF void +METHODDEF(void) finish_input_bmp (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) { /* no work */ @@ -419,7 +419,7 @@ finish_input_bmp (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) * The module selection routine for BMP format input. */ -GLOBAL cjpeg_source_ptr +GLOBAL(cjpeg_source_ptr) jinit_read_bmp (j_compress_ptr cinfo) { bmp_source_ptr source; diff --git a/rdcolmap.c b/rdcolmap.c index 2129e38..f79458e 100644 --- a/rdcolmap.c +++ b/rdcolmap.c @@ -1,7 +1,7 @@ /* * rdcolmap.c * - * Copyright (C) 1994-1995, Thomas G. Lane. + * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -42,7 +42,7 @@ * Add a (potentially) new color to the color map. */ -LOCAL void +LOCAL(void) add_map_entry (j_decompress_ptr cinfo, int R, int G, int B) { JSAMPROW colormap0 = cinfo->colormap[0]; @@ -75,7 +75,7 @@ add_map_entry (j_decompress_ptr cinfo, int R, int G, int B) * Extract color map from a GIF file. */ -LOCAL void +LOCAL(void) read_gif_map (j_decompress_ptr cinfo, FILE * infile) { int header[13]; @@ -117,7 +117,7 @@ read_gif_map (j_decompress_ptr cinfo, FILE * infile) /* Support routines for reading PPM */ -LOCAL int +LOCAL(int) pbm_getc (FILE * infile) /* Read next char, skipping over any comments */ /* A comment/newline sequence is returned as a newline */ @@ -134,7 +134,7 @@ pbm_getc (FILE * infile) } -LOCAL unsigned int +LOCAL(unsigned int) read_pbm_integer (j_decompress_ptr cinfo, FILE * infile) /* Read an unsigned decimal integer from the PPM file */ /* Swallows one trailing character after the integer */ @@ -167,7 +167,7 @@ read_pbm_integer (j_decompress_ptr cinfo, FILE * infile) * Extract color map from a PPM file. */ -LOCAL void +LOCAL(void) read_ppm_map (j_decompress_ptr cinfo, FILE * infile) { int c; @@ -227,7 +227,7 @@ read_ppm_map (j_decompress_ptr cinfo, FILE * infile) * Output: colormap and actual_number_of_colors fields are set in cinfo. */ -GLOBAL void +GLOBAL(void) read_color_map (j_decompress_ptr cinfo, FILE * infile) { /* Allocate space for a color map of maximum supported size. */ diff --git a/rdgif.c b/rdgif.c index 8ce2383..0da2515 100644 --- a/rdgif.c +++ b/rdgif.c @@ -1,7 +1,7 @@ /* * rdgif.c * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -126,15 +126,15 @@ typedef gif_source_struct * gif_source_ptr; /* Forward declarations */ -METHODDEF JDIMENSION get_pixel_rows +METHODDEF(JDIMENSION) get_pixel_rows JPP((j_compress_ptr cinfo, cjpeg_source_ptr sinfo)); -METHODDEF JDIMENSION load_interlaced_image +METHODDEF(JDIMENSION) load_interlaced_image JPP((j_compress_ptr cinfo, cjpeg_source_ptr sinfo)); -METHODDEF JDIMENSION get_interlaced_row +METHODDEF(JDIMENSION) get_interlaced_row JPP((j_compress_ptr cinfo, cjpeg_source_ptr sinfo)); -LOCAL int +LOCAL(int) ReadByte (gif_source_ptr sinfo) /* Read next byte from GIF file */ { @@ -147,7 +147,7 @@ ReadByte (gif_source_ptr sinfo) } -LOCAL int +LOCAL(int) GetDataBlock (gif_source_ptr sinfo, char *buf) /* Read a GIF data block, which has a leading count byte */ /* A zero-length block marks the end of a data block sequence */ @@ -163,7 +163,7 @@ GetDataBlock (gif_source_ptr sinfo, char *buf) } -LOCAL void +LOCAL(void) SkipDataBlocks (gif_source_ptr sinfo) /* Skip a series of data blocks, until a block terminator is found */ { @@ -174,7 +174,7 @@ SkipDataBlocks (gif_source_ptr sinfo) } -LOCAL void +LOCAL(void) ReInitLZW (gif_source_ptr sinfo) /* (Re)initialize LZW state; shared code for startup and Clear processing */ { @@ -185,7 +185,7 @@ ReInitLZW (gif_source_ptr sinfo) } -LOCAL void +LOCAL(void) InitLZWCode (gif_source_ptr sinfo) /* Initialize for a series of LZWReadByte (and hence GetCode) calls */ { @@ -204,7 +204,7 @@ InitLZWCode (gif_source_ptr sinfo) } -LOCAL int +LOCAL(int) GetCode (gif_source_ptr sinfo) /* Fetch the next code_size bits from the GIF data */ /* We assume code_size is less than 16 */ @@ -258,7 +258,7 @@ GetCode (gif_source_ptr sinfo) } -LOCAL int +LOCAL(int) LZWReadByte (gif_source_ptr sinfo) /* Read an LZW-compressed byte */ { @@ -350,7 +350,7 @@ LZWReadByte (gif_source_ptr sinfo) } -LOCAL void +LOCAL(void) ReadColorMap (gif_source_ptr sinfo, int cmaplen, JSAMPARRAY cmap) /* Read a GIF colormap */ { @@ -369,7 +369,7 @@ ReadColorMap (gif_source_ptr sinfo, int cmaplen, JSAMPARRAY cmap) } -LOCAL void +LOCAL(void) DoExtension (gif_source_ptr sinfo) /* Process an extension block */ /* Currently we ignore 'em all */ @@ -388,7 +388,7 @@ DoExtension (gif_source_ptr sinfo) * Read the file header; return image size and component count. */ -METHODDEF void +METHODDEF(void) start_input_gif (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) { gif_source_ptr source = (gif_source_ptr) sinfo; @@ -532,7 +532,7 @@ start_input_gif (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) * we read directly from the GIF file. */ -METHODDEF JDIMENSION +METHODDEF(JDIMENSION) get_pixel_rows (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) { gif_source_ptr source = (gif_source_ptr) sinfo; @@ -558,7 +558,7 @@ get_pixel_rows (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) * reading an interlaced GIF file: we read the whole image into memory. */ -METHODDEF JDIMENSION +METHODDEF(JDIMENSION) load_interlaced_image (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) { gif_source_ptr source = (gif_source_ptr) sinfo; @@ -604,7 +604,7 @@ load_interlaced_image (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) * we read from the virtual array. */ -METHODDEF JDIMENSION +METHODDEF(JDIMENSION) get_interlaced_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) { gif_source_ptr source = (gif_source_ptr) sinfo; @@ -652,7 +652,7 @@ get_interlaced_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) * Finish up at the end of the file. */ -METHODDEF void +METHODDEF(void) finish_input_gif (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) { /* no work */ @@ -663,7 +663,7 @@ finish_input_gif (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) * The module selection routine for GIF format input. */ -GLOBAL cjpeg_source_ptr +GLOBAL(cjpeg_source_ptr) jinit_read_gif (j_compress_ptr cinfo) { gif_source_ptr source; diff --git a/rdjpgcom.c b/rdjpgcom.c index 99e41e6..95770ec 100644 --- a/rdjpgcom.c +++ b/rdjpgcom.c @@ -23,7 +23,8 @@ #ifdef USE_CCOMMAND /* command-line reader for Macintosh */ #ifdef __MWERKS__ -#include /* Metrowerks declares it here */ +#include /* Metrowerks needs this */ +#include /* ... and this */ #endif #ifdef THINK_C #include /* Think declares it here */ diff --git a/rdppm.c b/rdppm.c index 2641e6d..e1c2a92 100644 --- a/rdppm.c +++ b/rdppm.c @@ -1,7 +1,7 @@ /* * rdppm.c * - * Copyright (C) 1991-1994, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -80,7 +80,7 @@ typedef struct { typedef ppm_source_struct * ppm_source_ptr; -LOCAL int +LOCAL(int) pbm_getc (FILE * infile) /* Read next char, skipping over any comments */ /* A comment/newline sequence is returned as a newline */ @@ -97,7 +97,7 @@ pbm_getc (FILE * infile) } -LOCAL unsigned int +LOCAL(unsigned int) read_pbm_integer (j_compress_ptr cinfo, FILE * infile) /* Read an unsigned decimal integer from the PPM file */ /* Swallows one trailing character after the integer */ @@ -137,7 +137,7 @@ read_pbm_integer (j_compress_ptr cinfo, FILE * infile) */ -METHODDEF JDIMENSION +METHODDEF(JDIMENSION) get_text_gray_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) /* This version is for reading text-format PGM files with any maxval */ { @@ -155,7 +155,7 @@ get_text_gray_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) } -METHODDEF JDIMENSION +METHODDEF(JDIMENSION) get_text_rgb_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) /* This version is for reading text-format PPM files with any maxval */ { @@ -175,7 +175,7 @@ get_text_rgb_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) } -METHODDEF JDIMENSION +METHODDEF(JDIMENSION) get_scaled_gray_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) /* This version is for reading raw-byte-format PGM files with any maxval */ { @@ -196,7 +196,7 @@ get_scaled_gray_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) } -METHODDEF JDIMENSION +METHODDEF(JDIMENSION) get_scaled_rgb_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) /* This version is for reading raw-byte-format PPM files with any maxval */ { @@ -219,7 +219,7 @@ get_scaled_rgb_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) } -METHODDEF JDIMENSION +METHODDEF(JDIMENSION) get_raw_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) /* This version is for reading raw-byte-format files with maxval = MAXJSAMPLE. * In this case we just read right into the JSAMPLE buffer! @@ -234,7 +234,7 @@ get_raw_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) } -METHODDEF JDIMENSION +METHODDEF(JDIMENSION) get_word_gray_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) /* This version is for reading raw-word-format PGM files with any maxval */ { @@ -258,7 +258,7 @@ get_word_gray_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) } -METHODDEF JDIMENSION +METHODDEF(JDIMENSION) get_word_rgb_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) /* This version is for reading raw-word-format PPM files with any maxval */ { @@ -292,7 +292,7 @@ get_word_rgb_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) * Read the file header; return image size and component count. */ -METHODDEF void +METHODDEF(void) start_input_ppm (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) { ppm_source_ptr source = (ppm_source_ptr) sinfo; @@ -420,7 +420,7 @@ start_input_ppm (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) * Finish up at the end of the file. */ -METHODDEF void +METHODDEF(void) finish_input_ppm (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) { /* no work */ @@ -431,7 +431,7 @@ finish_input_ppm (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) * The module selection routine for PPM format input. */ -GLOBAL cjpeg_source_ptr +GLOBAL(cjpeg_source_ptr) jinit_read_ppm (j_compress_ptr cinfo) { ppm_source_ptr source; diff --git a/rdrle.c b/rdrle.c index 8c19c7b..542bc37 100644 --- a/rdrle.c +++ b/rdrle.c @@ -1,7 +1,7 @@ /* * rdrle.c * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -77,7 +77,7 @@ typedef struct _rle_source_struct { * Read the file header; return image size and component count. */ -METHODDEF void +METHODDEF(void) start_input_rle (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) { rle_source_ptr source = (rle_source_ptr) sinfo; @@ -183,7 +183,7 @@ start_input_rle (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) * Used for GRAYSCALE, MAPPEDGRAY, TRUECOLOR, and DIRECTCOLOR images. */ -METHODDEF JDIMENSION +METHODDEF(JDIMENSION) get_rle_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) { rle_source_ptr source = (rle_source_ptr) sinfo; @@ -201,7 +201,7 @@ get_rle_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) * Used for PSEUDOCOLOR images. */ -METHODDEF JDIMENSION +METHODDEF(JDIMENSION) get_pseudocolor_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) { rle_source_ptr source = (rle_source_ptr) sinfo; @@ -237,7 +237,7 @@ get_pseudocolor_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) * the appropriate row-reading routine. */ -METHODDEF JDIMENSION +METHODDEF(JDIMENSION) load_image (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) { rle_source_ptr source = (rle_source_ptr) sinfo; @@ -356,7 +356,7 @@ load_image (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) * Finish up at the end of the file. */ -METHODDEF void +METHODDEF(void) finish_input_rle (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) { /* no work */ @@ -367,7 +367,7 @@ finish_input_rle (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) * The module selection routine for RLE format input. */ -GLOBAL cjpeg_source_ptr +GLOBAL(cjpeg_source_ptr) jinit_read_rle (j_compress_ptr cinfo) { rle_source_ptr source; diff --git a/rdswitch.c b/rdswitch.c index 7eaea72..4f4bb4f 100644 --- a/rdswitch.c +++ b/rdswitch.c @@ -1,7 +1,7 @@ /* * rdswitch.c * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -17,16 +17,7 @@ #include /* to declare isdigit(), isspace() */ -/* Hack: get access to jpeg_zigzag_order[] table in jutils.c. - * Since it's declared in jpegint.h, normally can't see it from an application. - */ -#ifdef NEED_SHORT_EXTERNAL_NAMES -#define jpeg_zigzag_order jZIGTable -#endif -extern const int jpeg_zigzag_order[]; - - -LOCAL int +LOCAL(int) text_getc (FILE * file) /* Read next char, skipping over any comments (# to end of line) */ /* A comment/newline sequence is returned as a newline */ @@ -43,7 +34,7 @@ text_getc (FILE * file) } -LOCAL boolean +LOCAL(boolean) read_text_integer (FILE * file, long * result, int * termchar) /* Read an unsigned decimal integer from a file, store it in result */ /* Reads one trailing character after the integer; returns it in termchar */ @@ -78,7 +69,7 @@ read_text_integer (FILE * file, long * result, int * termchar) } -GLOBAL boolean +GLOBAL(boolean) read_quant_tables (j_compress_ptr cinfo, char * filename, int scale_factor, boolean force_baseline) /* Read a set of quantization tables from the specified file. @@ -115,8 +106,7 @@ read_quant_tables (j_compress_ptr cinfo, char * filename, fclose(fp); return FALSE; } - /* Convert from natural order in the file to zigzag table order. */ - table[jpeg_zigzag_order[i]] = (unsigned int) val; + table[i] = (unsigned int) val; } jpeg_add_quant_table(cinfo, tblno, table, scale_factor, force_baseline); tblno++; @@ -135,7 +125,7 @@ read_quant_tables (j_compress_ptr cinfo, char * filename, #ifdef C_MULTISCAN_FILES_SUPPORTED -LOCAL boolean +LOCAL(boolean) read_scan_integer (FILE * file, long * result, int * termchar) /* Variant of read_text_integer that always looks for a non-space termchar; * this simplifies parsing of punctuation in scan scripts. @@ -164,7 +154,7 @@ read_scan_integer (FILE * file, long * result, int * termchar) } -GLOBAL boolean +GLOBAL(boolean) read_scan_script (j_compress_ptr cinfo, char * filename) /* Read a scan script from the specified text file. * Each entry in the file defines one scan to be emitted. @@ -272,7 +262,7 @@ bogus: #endif /* C_MULTISCAN_FILES_SUPPORTED */ -GLOBAL boolean +GLOBAL(boolean) set_quant_slots (j_compress_ptr cinfo, char *arg) /* Process a quantization-table-selectors parameter string, of the form * N[,N,...] @@ -307,7 +297,7 @@ set_quant_slots (j_compress_ptr cinfo, char *arg) } -GLOBAL boolean +GLOBAL(boolean) set_sample_factors (j_compress_ptr cinfo, char *arg) /* Process a sample-factors parameter string, of the form * HxV[,HxV,...] diff --git a/rdtarga.c b/rdtarga.c index 1f441c0..4c2cd26 100644 --- a/rdtarga.c +++ b/rdtarga.c @@ -1,7 +1,7 @@ /* * rdtarga.c * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -84,7 +84,7 @@ static const UINT8 c5to8bits[32] = { -LOCAL int +LOCAL(int) read_byte (tga_source_ptr sinfo) /* Read next byte from Targa file */ { @@ -97,7 +97,7 @@ read_byte (tga_source_ptr sinfo) } -LOCAL void +LOCAL(void) read_colormap (tga_source_ptr sinfo, int cmaplen, int mapentrysize) /* Read the colormap from a Targa file */ { @@ -119,7 +119,7 @@ read_colormap (tga_source_ptr sinfo, int cmaplen, int mapentrysize) * read_pixel methods: get a single pixel from Targa file into tga_pixel[] */ -LOCAL void +METHODDEF(void) read_non_rle_pixel (tga_source_ptr sinfo) /* Read one Targa pixel from the input file; no RLE expansion */ { @@ -132,7 +132,7 @@ read_non_rle_pixel (tga_source_ptr sinfo) } -LOCAL void +METHODDEF(void) read_rle_pixel (tga_source_ptr sinfo) /* Read one Targa pixel from the input file, expanding RLE data as needed */ { @@ -170,7 +170,7 @@ read_rle_pixel (tga_source_ptr sinfo) */ -METHODDEF JDIMENSION +METHODDEF(JDIMENSION) get_8bit_gray_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) /* This version is for reading 8-bit grayscale pixels */ { @@ -186,7 +186,7 @@ get_8bit_gray_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) return 1; } -METHODDEF JDIMENSION +METHODDEF(JDIMENSION) get_8bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) /* This version is for reading 8-bit colormap indexes */ { @@ -207,7 +207,7 @@ get_8bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) return 1; } -METHODDEF JDIMENSION +METHODDEF(JDIMENSION) get_16bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) /* This version is for reading 16-bit pixels */ { @@ -235,7 +235,7 @@ get_16bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) return 1; } -METHODDEF JDIMENSION +METHODDEF(JDIMENSION) get_24bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) /* This version is for reading 24-bit pixels */ { @@ -269,7 +269,7 @@ get_24bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) * with proper conversion of pixel format, but it's in a funny row order. */ -METHODDEF JDIMENSION +METHODDEF(JDIMENSION) get_memory_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) { tga_source_ptr source = (tga_source_ptr) sinfo; @@ -296,7 +296,7 @@ get_memory_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) * get_memory_row on subsequent calls. */ -METHODDEF JDIMENSION +METHODDEF(JDIMENSION) preload_image (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) { tga_source_ptr source = (tga_source_ptr) sinfo; @@ -329,7 +329,7 @@ preload_image (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) * Read the file header; return image size and component count. */ -METHODDEF void +METHODDEF(void) start_input_tga (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) { tga_source_ptr source = (tga_source_ptr) sinfo; @@ -469,7 +469,7 @@ start_input_tga (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) * Finish up at the end of the file. */ -METHODDEF void +METHODDEF(void) finish_input_tga (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) { /* no work */ @@ -480,7 +480,7 @@ finish_input_tga (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) * The module selection routine for Targa format input. */ -GLOBAL cjpeg_source_ptr +GLOBAL(cjpeg_source_ptr) jinit_read_targa (j_compress_ptr cinfo) { tga_source_ptr source; diff --git a/structure.doc b/structure.doc index b224b1f..51c9def 100644 --- a/structure.doc +++ b/structure.doc @@ -647,9 +647,16 @@ The underlying type is at least a 16-bit signed integer; while "short" is big enough on all machines of interest, on some machines it is preferable to use "int" for speed reasons, despite the storage cost. Coefficients are grouped into 8x8 blocks (but we always use #defines DCTSIZE and DCTSIZE2 rather than -"8" and "64"). The contents of a block may be either in "natural" or -zigzagged order, and may be true values or divided by the quantization -coefficients, depending on where the block is in the processing pipeline. +"8" and "64"). + +The contents of a coefficient block may be in either "natural" or zigzagged +order, and may be true values or divided by the quantization coefficients, +depending on where the block is in the processing pipeline. In the current +library, coefficient blocks are kept in natural order everywhere; the entropy +codecs zigzag or dezigzag the data as it is written or read. The blocks +contain quantized coefficients everywhere outside the DCT/IDCT subsystems. +(This latter decision may need to be revisited to support variable +quantization a la JPEG Part 3.) Notice that the allocation unit is now a row of 8x8 blocks, corresponding to eight rows of samples. Otherwise the structure is much the same as for diff --git a/wizard.doc b/wizard.doc index ad1d229..54170b2 100644 --- a/wizard.doc +++ b/wizard.doc @@ -137,14 +137,18 @@ JPEG SOF marker, with the first component being numbered 0. (Note that these indexes are not the "component ID" codes assigned to the components, just positional indexes.) -If the progression parameters Ss,Se,Ah,Al are omitted, the values 0,63,0,0 -are used, producing a sequential JPEG file. cjpeg automatically determines -whether the script represents a progressive or sequential file, by observing -whether Ss and Se values other than 0 and 63 appear. (The -progressive -switch is unnecessary and is ignored when -scans appears.) When specifying -progression parameters, the user must follow the JPEG restrictions on -progression parameters. (cjpeg checks that the spec's requirements are -obeyed.) +The progression parameters for each scan are: + Ss Zigzag index of first coefficient included in scan + Se Zigzag index of last coefficient included in scan + Ah Zero for first scan of a coefficient, else Al of prior scan + Al Successive approximation low bit position for scan +If the progression parameters are omitted, the values 0,63,0,0 are used, +producing a sequential JPEG file. cjpeg automatically determines whether +the script represents a progressive or sequential file, by observing whether +Ss and Se values other than 0 and 63 appear. (The -progressive switch is +not needed to specify this; in fact, it is ignored when -scans appears.) +The scan script must meet the JPEG restrictions on progression sequences. +(cjpeg checks that the spec's requirements are obeyed.) Scan script files are free format, in that arbitrary whitespace can appear between numbers and around punctuation. Also, comments can be included: a diff --git a/wrbmp.c b/wrbmp.c index fa144fc..3283b0f 100644 --- a/wrbmp.c +++ b/wrbmp.c @@ -1,7 +1,7 @@ /* * wrbmp.c * - * Copyright (C) 1994-1995, Thomas G. Lane. + * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -57,7 +57,7 @@ typedef bmp_dest_struct * bmp_dest_ptr; /* Forward declarations */ -LOCAL void write_colormap +LOCAL(void) write_colormap JPP((j_decompress_ptr cinfo, bmp_dest_ptr dest, int map_colors, int map_entry_size)); @@ -67,7 +67,7 @@ LOCAL void write_colormap * In this module rows_supplied will always be 1. */ -METHODDEF void +METHODDEF(void) put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, JDIMENSION rows_supplied) /* This version is for writing 24-bit pixels */ @@ -102,7 +102,7 @@ put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, *outptr++ = 0; } -METHODDEF void +METHODDEF(void) put_gray_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, JDIMENSION rows_supplied) /* This version is for grayscale OR quantized color output */ @@ -138,7 +138,7 @@ put_gray_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, * In this module we may as well postpone everything until finish_output. */ -METHODDEF void +METHODDEF(void) start_output_bmp (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) { /* no work here */ @@ -153,7 +153,7 @@ start_output_bmp (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) * First, routines to write the Windows and OS/2 variants of the file header. */ -LOCAL void +LOCAL(void) write_bmp_header (j_decompress_ptr cinfo, bmp_dest_ptr dest) /* Write a Windows-style BMP file header, including colormap if needed */ { @@ -226,7 +226,7 @@ write_bmp_header (j_decompress_ptr cinfo, bmp_dest_ptr dest) } -LOCAL void +LOCAL(void) write_os2_header (j_decompress_ptr cinfo, bmp_dest_ptr dest) /* Write an OS2-style BMP file header, including colormap if needed */ { @@ -288,7 +288,7 @@ write_os2_header (j_decompress_ptr cinfo, bmp_dest_ptr dest) * Windows uses BGR0 map entries; OS/2 uses BGR entries. */ -LOCAL void +LOCAL(void) write_colormap (j_decompress_ptr cinfo, bmp_dest_ptr dest, int map_colors, int map_entry_size) { @@ -340,7 +340,7 @@ write_colormap (j_decompress_ptr cinfo, bmp_dest_ptr dest, } -METHODDEF void +METHODDEF(void) finish_output_bmp (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) { bmp_dest_ptr dest = (bmp_dest_ptr) dinfo; @@ -386,7 +386,7 @@ finish_output_bmp (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) * The module selection routine for BMP format output. */ -GLOBAL djpeg_dest_ptr +GLOBAL(djpeg_dest_ptr) jinit_write_bmp (j_decompress_ptr cinfo, boolean is_os2) { bmp_dest_ptr dest; diff --git a/wrgif.c b/wrgif.c index 854903e..85cfaa8 100644 --- a/wrgif.c +++ b/wrgif.c @@ -1,7 +1,7 @@ /* * wrgif.c * - * Copyright (C) 1991-1994, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -116,7 +116,7 @@ typedef gif_dest_struct * gif_dest_ptr; * A data block consists of a count byte (1..255) and that many data bytes. */ -LOCAL void +LOCAL(void) flush_packet (gif_dest_ptr dinfo) /* flush any accumulated data */ { @@ -140,7 +140,7 @@ flush_packet (gif_dest_ptr dinfo) /* Routine to convert variable-width codes into a byte stream */ -LOCAL void +LOCAL(void) output (gif_dest_ptr dinfo, code_int code) /* Emit a code of n_bits bits */ /* Uses cur_accum and cur_bits to reblock into 8-bit bytes */ @@ -172,7 +172,7 @@ output (gif_dest_ptr dinfo, code_int code) /* The LZW algorithm proper */ -LOCAL void +LOCAL(void) clear_hash (gif_dest_ptr dinfo) /* Fill the hash table with empty entries */ { @@ -181,7 +181,7 @@ clear_hash (gif_dest_ptr dinfo) } -LOCAL void +LOCAL(void) clear_block (gif_dest_ptr dinfo) /* Reset compressor and issue a Clear code */ { @@ -193,7 +193,7 @@ clear_block (gif_dest_ptr dinfo) } -LOCAL void +LOCAL(void) compress_init (gif_dest_ptr dinfo, int i_bits) /* Initialize LZW compressor */ { @@ -215,7 +215,7 @@ compress_init (gif_dest_ptr dinfo, int i_bits) } -LOCAL void +LOCAL(void) compress_byte (gif_dest_ptr dinfo, int c) /* Accept and compress one 8-bit byte */ { @@ -273,7 +273,7 @@ compress_byte (gif_dest_ptr dinfo, int c) } -LOCAL void +LOCAL(void) compress_term (gif_dest_ptr dinfo) /* Clean up at end */ { @@ -294,7 +294,7 @@ compress_term (gif_dest_ptr dinfo) /* GIF header construction */ -LOCAL void +LOCAL(void) put_word (gif_dest_ptr dinfo, unsigned int w) /* Emit a 16-bit word, LSB first */ { @@ -303,7 +303,7 @@ put_word (gif_dest_ptr dinfo, unsigned int w) } -LOCAL void +LOCAL(void) put_3bytes (gif_dest_ptr dinfo, int val) /* Emit 3 copies of same byte value --- handy subr for colormap construction */ { @@ -313,7 +313,7 @@ put_3bytes (gif_dest_ptr dinfo, int val) } -LOCAL void +LOCAL(void) emit_header (gif_dest_ptr dinfo, int num_colors, JSAMPARRAY colormap) /* Output the GIF file header, including color map */ /* If colormap==NULL, synthesize a gray-scale colormap */ @@ -396,7 +396,7 @@ emit_header (gif_dest_ptr dinfo, int num_colors, JSAMPARRAY colormap) * Startup: write the file header. */ -METHODDEF void +METHODDEF(void) start_output_gif (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) { gif_dest_ptr dest = (gif_dest_ptr) dinfo; @@ -413,7 +413,7 @@ start_output_gif (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) * In this module rows_supplied will always be 1. */ -METHODDEF void +METHODDEF(void) put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, JDIMENSION rows_supplied) { @@ -432,7 +432,7 @@ put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, * Finish up at the end of the file. */ -METHODDEF void +METHODDEF(void) finish_output_gif (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) { gif_dest_ptr dest = (gif_dest_ptr) dinfo; @@ -454,7 +454,7 @@ finish_output_gif (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) * The module selection routine for GIF format output. */ -GLOBAL djpeg_dest_ptr +GLOBAL(djpeg_dest_ptr) jinit_write_gif (j_decompress_ptr cinfo) { gif_dest_ptr dest; diff --git a/wrjpgcom.c b/wrjpgcom.c index 1f029f8..3b6411c 100644 --- a/wrjpgcom.c +++ b/wrjpgcom.c @@ -26,7 +26,8 @@ extern void * malloc (); #ifdef USE_CCOMMAND /* command-line reader for Macintosh */ #ifdef __MWERKS__ -#include /* Metrowerks declares it here */ +#include /* Metrowerks needs this */ +#include /* ... and this */ #endif #ifdef THINK_C #include /* Think declares it here */ diff --git a/wrppm.c b/wrppm.c index 742ecfc..6c6d908 100644 --- a/wrppm.c +++ b/wrppm.c @@ -1,7 +1,7 @@ /* * wrppm.c * - * Copyright (C) 1991-1994, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -86,7 +86,7 @@ typedef ppm_dest_struct * ppm_dest_ptr; * output buffer is physically the same as the fwrite buffer. */ -METHODDEF void +METHODDEF(void) put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, JDIMENSION rows_supplied) { @@ -101,7 +101,7 @@ put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, * format translation. Typically this only happens in 12-bit mode. */ -METHODDEF void +METHODDEF(void) copy_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, JDIMENSION rows_supplied) { @@ -124,7 +124,7 @@ copy_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, * We have to demap the color index values to straight data. */ -METHODDEF void +METHODDEF(void) put_demapped_rgb (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, JDIMENSION rows_supplied) { @@ -149,7 +149,7 @@ put_demapped_rgb (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, } -METHODDEF void +METHODDEF(void) put_demapped_gray (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, JDIMENSION rows_supplied) { @@ -172,7 +172,7 @@ put_demapped_gray (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, * Startup: write the file header. */ -METHODDEF void +METHODDEF(void) start_output_ppm (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) { ppm_dest_ptr dest = (ppm_dest_ptr) dinfo; @@ -201,7 +201,7 @@ start_output_ppm (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) * Finish up at the end of the file. */ -METHODDEF void +METHODDEF(void) finish_output_ppm (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) { /* Make sure we wrote the output file OK */ @@ -215,7 +215,7 @@ finish_output_ppm (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) * The module selection routine for PPM format output. */ -GLOBAL djpeg_dest_ptr +GLOBAL(djpeg_dest_ptr) jinit_write_ppm (j_decompress_ptr cinfo) { ppm_dest_ptr dest; diff --git a/wrrle.c b/wrrle.c index 77c6c65..a4e7337 100644 --- a/wrrle.c +++ b/wrrle.c @@ -1,7 +1,7 @@ /* * wrrle.c * - * Copyright (C) 1991-1995, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -62,7 +62,7 @@ typedef struct { typedef rle_dest_struct * rle_dest_ptr; /* Forward declarations */ -METHODDEF void rle_put_pixel_rows +METHODDEF(void) rle_put_pixel_rows JPP((j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, JDIMENSION rows_supplied)); @@ -73,7 +73,7 @@ METHODDEF void rle_put_pixel_rows * In this module it's easier to wait till finish_output to write anything. */ -METHODDEF void +METHODDEF(void) start_output_rle (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) { rle_dest_ptr dest = (rle_dest_ptr) dinfo; @@ -149,7 +149,7 @@ start_output_rle (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) * This routine just saves the data away in a virtual array. */ -METHODDEF void +METHODDEF(void) rle_put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, JDIMENSION rows_supplied) { @@ -168,7 +168,7 @@ rle_put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, * Here is where we really output the RLE file. */ -METHODDEF void +METHODDEF(void) finish_output_rle (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) { rle_dest_ptr dest = (rle_dest_ptr) dinfo; @@ -273,7 +273,7 @@ finish_output_rle (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) * The module selection routine for RLE format output. */ -GLOBAL djpeg_dest_ptr +GLOBAL(djpeg_dest_ptr) jinit_write_rle (j_decompress_ptr cinfo) { rle_dest_ptr dest; diff --git a/wrtarga.c b/wrtarga.c index 3698712..cf104d2 100644 --- a/wrtarga.c +++ b/wrtarga.c @@ -1,7 +1,7 @@ /* * wrtarga.c * - * Copyright (C) 1991-1994, Thomas G. Lane. + * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -50,7 +50,7 @@ typedef struct { typedef tga_dest_struct * tga_dest_ptr; -LOCAL void +LOCAL(void) write_header (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, int num_colors) /* Create and write a Targa header */ { @@ -95,7 +95,7 @@ write_header (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, int num_colors) * In this module rows_supplied will always be 1. */ -METHODDEF void +METHODDEF(void) put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, JDIMENSION rows_supplied) /* used for unquantized full-color output */ @@ -116,7 +116,7 @@ put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, (void) JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width); } -METHODDEF void +METHODDEF(void) put_gray_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, JDIMENSION rows_supplied) /* used for grayscale OR quantized color output */ @@ -140,7 +140,7 @@ put_gray_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, * For Targa, this is only applied to grayscale data. */ -METHODDEF void +METHODDEF(void) put_demapped_gray (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, JDIMENSION rows_supplied) { @@ -163,7 +163,7 @@ put_demapped_gray (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, * Startup: write the file header. */ -METHODDEF void +METHODDEF(void) start_output_tga (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) { tga_dest_ptr dest = (tga_dest_ptr) dinfo; @@ -207,7 +207,7 @@ start_output_tga (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) * Finish up at the end of the file. */ -METHODDEF void +METHODDEF(void) finish_output_tga (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) { /* Make sure we wrote the output file OK */ @@ -221,7 +221,7 @@ finish_output_tga (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) * The module selection routine for Targa format output. */ -GLOBAL djpeg_dest_ptr +GLOBAL(djpeg_dest_ptr) jinit_write_targa (j_decompress_ptr cinfo) { tga_dest_ptr dest;